1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-17 18:16:22 -05:00

Review formatted string printing when '%' is at end of string.

Clean up unused IO return code.
This commit is contained in:
Renaud 2016-04-05 11:33:38 +08:00
parent 16e6f87ad5
commit f83ab08609
2 changed files with 9 additions and 9 deletions

View File

@ -1333,12 +1333,14 @@ void vmlwrite( const char *fmt, va_list ap) {
movecursor( term.t_nrow, 0) ; movecursor( term.t_nrow, 0) ;
mpresf = *fmt ? TRUE : FALSE ; /* flag if line has content or not */ mpresf = *fmt ? TRUE : FALSE ; /* flag if line has content or not */
while ((c = *fmt++) != 0) { while( ( c = *fmt++) != 0)
if (c != '%') if( c != '%')
mlputc( c) ; mlputc( c) ;
else { else if( ( c = *fmt++) == 0) {
c = *fmt++; mlputc( '%') ;
switch (c) { break ;
} else
switch( c) {
case 'd': case 'd':
mlputi(va_arg(ap, int), 10); mlputi(va_arg(ap, int), 10);
break; break;
@ -1369,11 +1371,10 @@ void vmlwrite( const char *fmt, va_list ap) {
default: default:
mlputc( '%') ; mlputc( '%') ;
/* fallthrough */
case '%': case '%':
mlputc( c) ; mlputc( c) ;
} }
}
}
/* if we can, erase to the end of screen */ /* if we can, erase to the end of screen */
if( eolexist == TRUE && ttcol < term.t_ncol) if( eolexist == TRUE && ttcol < term.t_ncol)

View File

@ -6,8 +6,7 @@ typedef enum {
FIOFNF, /* File I/O, file not found. */ FIOFNF, /* File I/O, file not found. */
FIOEOF, /* File I/O, end of file. */ FIOEOF, /* File I/O, end of file. */
FIOERR, /* File I/O, error. */ FIOERR, /* File I/O, error. */
FIOMEM, /* File I/O, out of memory */ FIOMEM /* File I/O, out of memory */
FIOFUN /* File I/O, eod of file/bad line */
} fio_code ; } fio_code ;
#define FTYPE_NONE 0 #define FTYPE_NONE 0