1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-09 05:20:42 +00:00

Insure debug output fits inside terminal and buffer width.

This commit is contained in:
Renaud 2015-01-15 16:46:45 +08:00
parent e3c8805260
commit 01a84a3ac0

9
eval.c
View File

@ -798,11 +798,16 @@ int setvar(int f, int n)
#if DEBUGM #if DEBUGM
int mdbugout( char *fmt, char *s1, char *s2, char *s3) { int mdbugout( char *fmt, char *s1, char *s2, char *s3) {
char outline[ NSTRING] ; /* global string to hold debug line text */ char outline[ NSTRING] ; /* global string to hold debug line text */
int c ; /* input from kbd */ int c, size ; /* input from kbd, output to terminal */
char *sp ; /* temp string pointer */ char *sp ; /* temp string pointer */
/* insure debug info fits in terminal and buffer width */
size = term.t_ncol + 1 ;
if( size > sizeof outline)
size = sizeof outline ;
/* assignment status ; variable name ; value we tried to assign */ /* assignment status ; variable name ; value we tried to assign */
sprintf( outline, fmt, s1, s2, s3) ; snprintf( outline, size, fmt, s1, s2, s3) ;
/* expand '%' to "%%" so mlwrite wont bitch */ /* expand '%' to "%%" so mlwrite wont bitch */
sp = outline; sp = outline;