mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
Review usage of mlreply/ macarg/ gettokval according to execution context.
This commit is contained in:
parent
8d412dc388
commit
c3f4666ff3
2
bind.c
2
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) ;
|
||||
|
7
eval.c
7
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;
|
||||
|
18
exec.c
18
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;
|
||||
/* 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)
|
||||
{
|
||||
static int macarg( char *tok, int toksz) {
|
||||
int status ;
|
||||
boolean savcle ; /* buffer to store original clexec */
|
||||
int status;
|
||||
|
||||
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 ;
|
||||
}
|
||||
|
||||
/*
|
||||
|
1
exec.h
1
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) ;
|
||||
|
Loading…
Reference in New Issue
Block a user