From 703c472f0b49b69418419213273f6518f8da6e2a Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Fri, 13 Feb 2015 21:48:05 +0800 Subject: [PATCH] Review message line outputs. --- bindable.c | 16 ++++++++-------- file.c | 2 +- input.c | 13 +++++++------ input.h | 1 - main.c | 2 +- search.c | 42 +++++++++++++++++++++--------------------- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/bindable.c b/bindable.c index 50ac1d5..bdf15f3 100644 --- a/bindable.c +++ b/bindable.c @@ -32,10 +32,10 @@ int quickexit(int f, int n) && (bp->b_flag & BFTRUNC) == 0 /* Not truncated P.K. */ && (bp->b_flag & BFINVS) == 0) { /* Real. */ curbp = bp; /* make that buffer cur */ - mlwrite("(Saving %s)", bp->b_fname); + mloutfmt( "(Saving %s)", bp->b_fname) ; #if PKCODE #else - mlwrite("\n"); + mloutstr( "\n") ; #endif if ((status = filesave(f, n)) != TRUE) { curbp = oldcb; /* restore curbp */ @@ -76,7 +76,7 @@ int quit(int f, int n) else exit( EXIT_SUCCESS) ; } - mlwrite(""); + mloutstr( "") ; return s; } @@ -88,10 +88,10 @@ int quit(int f, int n) int ctlxlp(int f, int n) { if (kbdmode != STOP) { - mlwrite("%%Macro already active"); + mloutstr( "%Macro already active") ; return FALSE; } - mlwrite("(Start macro)"); + mloutstr( "(Start macro)") ; kbdptr = &kbdm[0]; kbdend = kbdptr; kbdmode = RECORD; @@ -105,11 +105,11 @@ int ctlxlp(int f, int n) int ctlxrp(int f, int n) { if (kbdmode == STOP) { - mlwrite("%%Macro not active"); + mloutstr( "%Macro not active") ; return FALSE; } if (kbdmode == RECORD) { - mlwrite("(End macro)"); + mloutstr( "(End macro)") ; kbdmode = STOP; } return TRUE; @@ -123,7 +123,7 @@ int ctlxrp(int f, int n) int ctlxe(int f, int n) { if (kbdmode != STOP) { - mlwrite("%%Macro already active"); + mloutstr( "%Macro already active") ; return FALSE; } if (n <= 0) diff --git a/file.c b/file.c index eaf0aeb..9e3fadd 100644 --- a/file.c +++ b/file.c @@ -174,7 +174,7 @@ int set_encryption_key(int f, int n) strcpy(curbp->b_key, key); cryptbufferkey( curbp) ; - mloutstr( " ") ; /* clear it off the bottom line */ + mloutstr( "") ; /* clear the message line */ return TRUE; } diff --git a/input.c b/input.c index 362f433..6d966fe 100644 --- a/input.c +++ b/input.c @@ -54,6 +54,8 @@ int abortc = CONTROL | 'G' ; /* current abort command char */ static const int quotec = 0x11 ; /* quote char during mlreply() */ +static void outstring( char *s) ; + /* * Ask a yes or no question in the message line. Return either TRUE, FALSE, or * ABORT. The ABORT status is returned if the user bumps out of the question @@ -740,15 +742,14 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar) } /* - * output a string of characters + * output a string of characters when display input is enabled * * char *s; string to output */ -void outstring(char *s) -{ - if (disinp) - while (*s) - TTputc(*s++); +static void outstring( char *s) { + if( disinp) + while( *s) + TTputc( *s++) ; } /* diff --git a/input.h b/input.h index 98befd1..03aa106 100644 --- a/input.h +++ b/input.h @@ -30,7 +30,6 @@ int tgetc( void) ; int get1key( void) ; int getcmd( void) ; int getstring( const char *prompt, char *buf, int nbuf, int eolchar) ; -void outstring( char *s) ; void ostring( char *s) ; #endif diff --git a/main.c b/main.c index d9c8f36..cdeb910 100644 --- a/main.c +++ b/main.c @@ -375,7 +375,7 @@ int main(int argc, char **argv) #endif /* if there is something on the command line, clear it */ if (mpresf != FALSE) { - mlerase(); + mloutstr( "") ; update(FALSE); #if CLRMSG if (c == ' ') /* ITS EMACS does this */ diff --git a/search.c b/search.c index 85c79ab..5451d1e 100644 --- a/search.c +++ b/search.c @@ -216,7 +216,7 @@ int forwsearch(int f, int n) if (status == TRUE) savematch(); else - mlwrite("Not found"); + mloutstr( "Not found") ; } return status; } @@ -239,7 +239,7 @@ int forwhunt(int f, int n) * into MAGIC mode until after we entered the pattern. */ if (pat[0] == '\0') { - mlwrite("No pattern set"); + mloutstr( "No pattern set") ; return FALSE; } #if MAGIC @@ -269,7 +269,7 @@ int forwhunt(int f, int n) if (status == TRUE) savematch(); else - mlwrite("Not found"); + mloutstr( "Not found") ; return status; } @@ -317,7 +317,7 @@ int backsearch(int f, int n) if (status == TRUE) savematch(); else - mlwrite("Not found"); + mloutstr( "Not found") ; } return status; } @@ -341,7 +341,7 @@ int backhunt(int f, int n) * into MAGIC mode until after we entered the pattern. */ if (tap[0] == '\0') { - mlwrite("No pattern set"); + mloutstr( "No pattern set") ; return FALSE; } #if MAGIC @@ -371,7 +371,7 @@ int backhunt(int f, int n) if (status == TRUE) savematch(); else - mlwrite("Not found"); + mloutstr( "Not found") ; return status; } @@ -909,12 +909,12 @@ static int replaces(int kind, int f, int n) if (kind) { /* Get the query. */ - pprompt:mlwrite(&tpat[0], &pat[0], - &rpat[0]); - qprompt: + pprompt: + mloutfmt( &tpat[ 0], &pat[ 0], &rpat[ 0]) ; + qprompt: update(TRUE); /* show the proposed place to change */ c = tgetc(); /* and input */ - mlwrite(""); /* and clear it */ + mloutstr( "") ; /* and clear it */ /* And respond appropriately. */ @@ -991,8 +991,8 @@ static int replaces(int kind, int f, int n) TTbeep(); case '?': /* help me */ - mlwrite - ("(Y)es, (N)o, (!)Do rest, (U)ndo last, (^G)Abort, (.)Abort back, (?)Help: "); + mloutstr( + "(Y)es, (N)o, (!)Do rest, (U)ndo last, (^G)Abort, (.)Abort back, (?)Help: ") ; goto qprompt; } /* end of switch */ @@ -1020,7 +1020,7 @@ static int replaces(int kind, int f, int n) /* And report the results. */ - mlwrite("%d substitutions", numsub); + mloutfmt( "%d substitutions", numsub) ; return TRUE; } @@ -1040,7 +1040,7 @@ int delins(int dlength, char *instr, int use_meta) * and insert its replacement. */ if ((status = ldelete((long) dlength, FALSE)) != TRUE) - mlwrite("%%ERROR while deleting"); + mloutstr( "%ERROR while deleting") ; else #if MAGIC if ((rmagical && use_meta) && @@ -1327,7 +1327,7 @@ static int rmcstr(void) rmcptr->mc_type = LITCHAR; if ((rmcptr->rstr = malloc(mj + 1)) == NULL) { - mlwrite("%%Out of memory"); + mloutstr( "%Out of memory") ; status = FALSE; break; } @@ -1348,7 +1348,7 @@ static int rmcstr(void) * current character. */ if ((rmcptr->rstr = malloc(mj + 2)) == NULL) { - mlwrite("%%Out of memory"); + mloutstr( "%Out of memory") ; status = FALSE; break; } @@ -1377,7 +1377,7 @@ static int rmcstr(void) if (rmagical && mj > 0) { rmcptr->mc_type = LITCHAR; if ((rmcptr->rstr = malloc(mj + 1)) == NULL) { - mlwrite("%%Out of memory."); + mloutstr( "%Out of memory") ; status = FALSE; } strncpy(rmcptr->rstr, patptr - mj, mj); @@ -1464,7 +1464,7 @@ static int mceq(int bc, struct magic *mt) break; default: - mlwrite("mceq: what is %d?", mt->mc_type); + mloutfmt( "mceq: what is %d?", mt->mc_type) ; result = FALSE; break; @@ -1486,7 +1486,7 @@ static int cclmake(char **ppatptr, struct magic *mcptr) int pchr, ochr; if ((bmap = clearbits()) == NULL) { - mlwrite("%%Out of memory"); + mloutstr( "%Out of memory") ; return FALSE; } @@ -1506,7 +1506,7 @@ static int cclmake(char **ppatptr, struct magic *mcptr) mcptr->mc_type = CCL; if ((ochr = *patptr) == MC_ECCL) { - mlwrite("%%No characters in character class"); + mloutstr( "%No characters in character class") ; return FALSE; } else { if (ochr == MC_ESC) @@ -1547,7 +1547,7 @@ static int cclmake(char **ppatptr, struct magic *mcptr) *ppatptr = patptr; if (ochr == '\0') { - mlwrite("%%Character class not ended"); + mloutstr( "%Character class not ended") ; free(bmap); return FALSE; }