From fbfaa29497608a0edb42b88b1877e2c955937661 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Wed, 21 Jan 2015 14:12:24 +0800 Subject: [PATCH] Add %B in string format of mlwrite to ring a bell. --- basic.c | 6 +++--- bindable.c | 2 +- display.c | 4 ++++ execute.c | 2 +- line.c | 4 ++-- log.c | 9 ++++----- log.h | 2 +- main.c | 5 +---- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/basic.c b/basic.c index e1f5679..0d79d04 100644 --- a/basic.c +++ b/basic.c @@ -101,7 +101,7 @@ int gotoline(int f, int n) if( f == FALSE) { status = mlreply( "Line to GOTO: ", arg, sizeof arg) ; if( status != TRUE) - return logger( status, FALSE, "(Aborted)") ; + return logger( status, "(Aborted)") ; n = atoi( arg) ; } @@ -313,7 +313,7 @@ int setmark(int f, int n) { curwp->w_markp = curwp->w_dotp; curwp->w_marko = curwp->w_doto; - return logger( TRUE, FALSE, "(Mark set)") ; + return logger( TRUE, "(Mark set)") ; } /* @@ -328,7 +328,7 @@ int swapmark(int f, int n) int odoto; if( curwp->w_markp == NULL) - return logger( FALSE, FALSE, "No mark in this window") ; + return logger( FALSE, "No mark in this window") ; odotp = curwp->w_dotp; odoto = curwp->w_doto; diff --git a/bindable.c b/bindable.c index 595255c..8777f4f 100644 --- a/bindable.c +++ b/bindable.c @@ -150,7 +150,7 @@ int ctlxe(int f, int n) */ int ctrlg( int f, int n) { kbdmode = STOP ; - return logger( ABORT, TRUE, "(Aborted)") ; + return logger( ABORT, "%B(Aborted)") ; } /* user function that does NOTHING */ diff --git a/display.c b/display.c index 2ec8e80..cd93f39 100644 --- a/display.c +++ b/display.c @@ -1396,6 +1396,10 @@ void mlwrite(const char *fmt, ...) mlputf(va_arg(ap, int)); break; + case 'B': /* ring a bell */ + TTbeep() ; + break ; + default: TTputc(c); ++ttcol; diff --git a/execute.c b/execute.c index c5ddfd9..255501e 100644 --- a/execute.c +++ b/execute.c @@ -102,6 +102,6 @@ int execute(int c, int f, int n) } lastflag = 0 ; /* Fake last flags. */ - return logger( FALSE, TRUE, "(Key not bound)") ; /* Complain */ + return logger( FALSE, "%B(Key not bound)") ; /* Complain */ } diff --git a/line.c b/line.c index 9bfcc83..060f7f2 100644 --- a/line.c +++ b/line.c @@ -269,7 +269,7 @@ int linstr( char *instr) { /* Insertion error? */ if( status != TRUE) - return logger( status, FALSE, "%%Out of memory while inserting") ; + return logger( status, "%%Out of memory while inserting") ; } } @@ -419,7 +419,7 @@ int lover( char *ostr) { /* Insertion error? */ if( status != TRUE) - return logger( status, FALSE, "%%Out of memory while overwriting") ; + return logger( status, "%%Out of memory while overwriting") ; } } diff --git a/log.c b/log.c index d0bdc32..492ad21 100644 --- a/log.c +++ b/log.c @@ -5,24 +5,23 @@ static void logdump( const char *buf, ...) { void (*logwrite)( const char *, ...) = logdump ; -static boolean logit( boolean retcode, boolean beep_f, const char *buf, ...) { +static boolean logit( boolean retcode, const char *buf, ...) { return retcode ; } -boolean (*logger)( boolean, boolean, const char *, ...) = logit ; +boolean (*logger)( boolean, const char *, ...) = logit ; /* * tell the user that this command is illegal while we are in * VIEW (read-only) mode */ boolean rdonly( void) { - return logger( FALSE, TRUE, "(Key illegal in VIEW mode)"); + return logger( FALSE, "%B(Key illegal in VIEW mode)"); } - boolean resterr( void) { - return logger( FALSE, TRUE, "(That command is RESTRICTED)"); + return logger( FALSE, "%B(That command is RESTRICTED)"); } diff --git a/log.h b/log.h index 4441fad..b23a661 100644 --- a/log.h +++ b/log.h @@ -4,5 +4,5 @@ boolean rdonly( void) ; boolean resterr( void) ; extern void (*logwrite)( const char *, ...) ; -extern boolean (*logger)( boolean, boolean, const char *, ...) ; +extern boolean (*logger)( boolean, const char *, ...) ; diff --git a/main.c b/main.c index 0b9a1ec..6ab7832 100644 --- a/main.c +++ b/main.c @@ -130,10 +130,7 @@ static void usage( void) { } -static boolean mllog( boolean retcode, boolean beep_f, const char *buf, ...) { - if( beep_f) - TTbeep() ; - +static boolean mllog( boolean retcode, const char *buf, ...) { mlwrite( buf) ; return retcode ; }