1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-18 00:35:22 +00:00

Add %B in string format of mlwrite to ring a bell.

This commit is contained in:
Renaud 2015-01-21 14:12:24 +08:00
parent 4ca3f53385
commit fbfaa29497
8 changed files with 17 additions and 17 deletions

View File

@ -101,7 +101,7 @@ int gotoline(int f, int n)
if( f == FALSE) { if( f == FALSE) {
status = mlreply( "Line to GOTO: ", arg, sizeof arg) ; status = mlreply( "Line to GOTO: ", arg, sizeof arg) ;
if( status != TRUE) if( status != TRUE)
return logger( status, FALSE, "(Aborted)") ; return logger( status, "(Aborted)") ;
n = atoi( arg) ; n = atoi( arg) ;
} }
@ -313,7 +313,7 @@ int setmark(int f, int n)
{ {
curwp->w_markp = curwp->w_dotp; curwp->w_markp = curwp->w_dotp;
curwp->w_marko = curwp->w_doto; 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; int odoto;
if( curwp->w_markp == NULL) 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; odotp = curwp->w_dotp;
odoto = curwp->w_doto; odoto = curwp->w_doto;

View File

@ -150,7 +150,7 @@ int ctlxe(int f, int n)
*/ */
int ctrlg( int f, int n) { int ctrlg( int f, int n) {
kbdmode = STOP ; kbdmode = STOP ;
return logger( ABORT, TRUE, "(Aborted)") ; return logger( ABORT, "%B(Aborted)") ;
} }
/* user function that does NOTHING */ /* user function that does NOTHING */

View File

@ -1396,6 +1396,10 @@ void mlwrite(const char *fmt, ...)
mlputf(va_arg(ap, int)); mlputf(va_arg(ap, int));
break; break;
case 'B': /* ring a bell */
TTbeep() ;
break ;
default: default:
TTputc(c); TTputc(c);
++ttcol; ++ttcol;

View File

@ -102,6 +102,6 @@ int execute(int c, int f, int n)
} }
lastflag = 0 ; /* Fake last flags. */ lastflag = 0 ; /* Fake last flags. */
return logger( FALSE, TRUE, "(Key not bound)") ; /* Complain */ return logger( FALSE, "%B(Key not bound)") ; /* Complain */
} }

4
line.c
View File

@ -269,7 +269,7 @@ int linstr( char *instr) {
/* Insertion error? */ /* Insertion error? */
if( status != TRUE) 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? */ /* Insertion error? */
if( status != TRUE) if( status != TRUE)
return logger( status, FALSE, "%%Out of memory while overwriting") ; return logger( status, "%%Out of memory while overwriting") ;
} }
} }

9
log.c
View File

@ -5,24 +5,23 @@ static void logdump( const char *buf, ...) {
void (*logwrite)( const char *, ...) = logdump ; 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 ; 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 * tell the user that this command is illegal while we are in
* VIEW (read-only) mode * VIEW (read-only) mode
*/ */
boolean rdonly( void) { boolean rdonly( void) {
return logger( FALSE, TRUE, "(Key illegal in VIEW mode)"); return logger( FALSE, "%B(Key illegal in VIEW mode)");
} }
boolean resterr( void) { boolean resterr( void) {
return logger( FALSE, TRUE, "(That command is RESTRICTED)"); return logger( FALSE, "%B(That command is RESTRICTED)");
} }

2
log.h
View File

@ -4,5 +4,5 @@ boolean rdonly( void) ;
boolean resterr( void) ; boolean resterr( void) ;
extern void (*logwrite)( const char *, ...) ; extern void (*logwrite)( const char *, ...) ;
extern boolean (*logger)( boolean, boolean, const char *, ...) ; extern boolean (*logger)( boolean, const char *, ...) ;

5
main.c
View File

@ -130,10 +130,7 @@ static void usage( void) {
} }
static boolean mllog( boolean retcode, boolean beep_f, const char *buf, ...) { static boolean mllog( boolean retcode, const char *buf, ...) {
if( beep_f)
TTbeep() ;
mlwrite( buf) ; mlwrite( buf) ;
return retcode ; return retcode ;
} }