diff --git a/bind.c b/bind.c index 9733fff..10422e9 100644 --- a/bind.c +++ b/bind.c @@ -441,7 +441,7 @@ static unsigned int getckey( int mflag) { if( clexec) { char tok[ NSTRING] ; /* command incoming */ - if( TRUE != macarg( tok, sizeof tok)) /* get the next token */ + if( TRUE != gettokval( tok, sizeof tok)) /* get the next token */ c = 0 ; /* return dummy key on failure */ else c = stock( tok) ; diff --git a/eval.c b/eval.c index 0a99600..671c7aa 100644 --- a/eval.c +++ b/eval.c @@ -344,16 +344,17 @@ static char *gtfun( char *fname) { arg1 = arg2 = NULL ; + assert( clexec == TRUE) ; /* means macarg can be replaced by gettokval */ /* if needed, retrieve the first argument */ if (funcs[fnum].f_type >= MONAMIC) { - if( macarg( argx, sizeof argx) != TRUE) + if( TRUE != gettokval( argx, sizeof argx)) return errorm; /* if needed, retrieve the second argument */ if (funcs[fnum].f_type >= DYNAMIC) { arg1 = malloc( strlen( argx) + 1) ; strcpy( arg1, argx) ; - if( macarg( argx, sizeof argx) != TRUE) { + if( TRUE != gettokval( argx, sizeof argx)) { free( arg1) ; return errorm; } @@ -362,7 +363,7 @@ static char *gtfun( char *fname) { if (funcs[fnum].f_type >= TRINAMIC) { arg2 = malloc( strlen( argx) + 1) ; strcpy( arg2, argx) ; - if( macarg( argx, sizeof argx) != TRUE) { + if( TRUE != gettokval( argx, sizeof argx)) { free( arg1) ; free( arg2) ; return errorm; diff --git a/exec.c b/exec.c index 601baac..afb3933 100644 --- a/exec.c +++ b/exec.c @@ -79,6 +79,7 @@ static int mstore = FALSE ; /* storing text to macro flag */ static int dobuf( struct buffer *bp) ; static void freewhile( struct while_block *wp) ; +static int macarg( char *tok, int toksz) ; void ue_system( const char *cmd) { int ret ; @@ -179,8 +180,10 @@ static int docmd( char *cline) { /* process leadin argument */ if( !is_it_cmd( tkn)) { f = TRUE; - strncpy( tkn, getval( tkn), sizeof tkn - 1) ; - tkn[ sizeof tkn - 1] = '\0' ; +/* macarg already includes a getval, skip for now + strncpy( tkn, getval( tkn), sizeof tkn - 1) ; + tkn[ sizeof tkn - 1] = '\0' ; +*/ n = atoi(tkn); /* and now get the command to execute */ @@ -308,16 +311,15 @@ boolean gettokval( char *tok, int size) { * * char *tok; buffer to place argument */ -int macarg( char *tok, int toksz) -{ - boolean savcle ; /* buffer to store original clexec */ - int status; +static int macarg( char *tok, int toksz) { + int status ; + boolean savcle ; /* buffer to store original clexec */ - savcle = clexec; /* save execution mode */ - clexec = TRUE; /* get the argument */ - status = mlreply( "", tok, toksz) ; - clexec = savcle; /* restore execution mode */ - return status; + savcle = clexec ; /* save execution mode */ + clexec = TRUE ; /* get the argument */ + status = gettokval( tok, toksz) ; + clexec = savcle ; /* restore execution mode */ + return status ; } /* diff --git a/exec.h b/exec.h index 8a16448..8250982 100644 --- a/exec.h +++ b/exec.h @@ -20,7 +20,6 @@ int namedcmd( int f, int n) ; int execcmd( int f, int n) ; void gettoken( char *tok, int maxtoksize) ; boolean gettokval( char *tok, int maxtoksize) ; -int macarg( char *tok, int toksz) ; int storemac( int f, int n) ; int execbuf( int f, int n) ; int execfile( int f, int n) ; diff --git a/input.c b/input.c index 6d67643..d86397b 100644 --- a/input.c +++ b/input.c @@ -152,7 +152,7 @@ fn_t getname(void) /* if we are executing a command line get the next arg and match it */ if (clexec) { - if( macarg( buf, sizeof buf) != TRUE) + if( TRUE != gettokval( buf, sizeof buf)) return NULL; return fncmatch(&buf[0]); }