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) {
|
if( clexec) {
|
||||||
char tok[ NSTRING] ; /* command incoming */
|
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 */
|
c = 0 ; /* return dummy key on failure */
|
||||||
else
|
else
|
||||||
c = stock( tok) ;
|
c = stock( tok) ;
|
||||||
|
7
eval.c
7
eval.c
@ -344,16 +344,17 @@ static char *gtfun( char *fname) {
|
|||||||
|
|
||||||
arg1 = arg2 = NULL ;
|
arg1 = arg2 = NULL ;
|
||||||
|
|
||||||
|
assert( clexec == TRUE) ; /* means macarg can be replaced by gettokval */
|
||||||
/* if needed, retrieve the first argument */
|
/* if needed, retrieve the first argument */
|
||||||
if (funcs[fnum].f_type >= MONAMIC) {
|
if (funcs[fnum].f_type >= MONAMIC) {
|
||||||
if( macarg( argx, sizeof argx) != TRUE)
|
if( TRUE != gettokval( argx, sizeof argx))
|
||||||
return errorm;
|
return errorm;
|
||||||
|
|
||||||
/* if needed, retrieve the second argument */
|
/* if needed, retrieve the second argument */
|
||||||
if (funcs[fnum].f_type >= DYNAMIC) {
|
if (funcs[fnum].f_type >= DYNAMIC) {
|
||||||
arg1 = malloc( strlen( argx) + 1) ;
|
arg1 = malloc( strlen( argx) + 1) ;
|
||||||
strcpy( arg1, argx) ;
|
strcpy( arg1, argx) ;
|
||||||
if( macarg( argx, sizeof argx) != TRUE) {
|
if( TRUE != gettokval( argx, sizeof argx)) {
|
||||||
free( arg1) ;
|
free( arg1) ;
|
||||||
return errorm;
|
return errorm;
|
||||||
}
|
}
|
||||||
@ -362,7 +363,7 @@ static char *gtfun( char *fname) {
|
|||||||
if (funcs[fnum].f_type >= TRINAMIC) {
|
if (funcs[fnum].f_type >= TRINAMIC) {
|
||||||
arg2 = malloc( strlen( argx) + 1) ;
|
arg2 = malloc( strlen( argx) + 1) ;
|
||||||
strcpy( arg2, argx) ;
|
strcpy( arg2, argx) ;
|
||||||
if( macarg( argx, sizeof argx) != TRUE) {
|
if( TRUE != gettokval( argx, sizeof argx)) {
|
||||||
free( arg1) ;
|
free( arg1) ;
|
||||||
free( arg2) ;
|
free( arg2) ;
|
||||||
return errorm;
|
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 int dobuf( struct buffer *bp) ;
|
||||||
static void freewhile( struct while_block *wp) ;
|
static void freewhile( struct while_block *wp) ;
|
||||||
|
static int macarg( char *tok, int toksz) ;
|
||||||
|
|
||||||
void ue_system( const char *cmd) {
|
void ue_system( const char *cmd) {
|
||||||
int ret ;
|
int ret ;
|
||||||
@ -179,8 +180,10 @@ static int docmd( char *cline) {
|
|||||||
/* process leadin argument */
|
/* process leadin argument */
|
||||||
if( !is_it_cmd( tkn)) {
|
if( !is_it_cmd( tkn)) {
|
||||||
f = TRUE;
|
f = TRUE;
|
||||||
|
/* macarg already includes a getval, skip for now
|
||||||
strncpy( tkn, getval( tkn), sizeof tkn - 1) ;
|
strncpy( tkn, getval( tkn), sizeof tkn - 1) ;
|
||||||
tkn[ sizeof tkn - 1] = '\0' ;
|
tkn[ sizeof tkn - 1] = '\0' ;
|
||||||
|
*/
|
||||||
n = atoi(tkn);
|
n = atoi(tkn);
|
||||||
|
|
||||||
/* and now get the command to execute */
|
/* and now get the command to execute */
|
||||||
@ -308,16 +311,15 @@ boolean gettokval( char *tok, int size) {
|
|||||||
*
|
*
|
||||||
* char *tok; buffer to place argument
|
* 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 */
|
boolean savcle ; /* buffer to store original clexec */
|
||||||
int status;
|
|
||||||
|
|
||||||
savcle = clexec; /* save execution mode */
|
savcle = clexec ; /* save execution mode */
|
||||||
clexec = TRUE; /* get the argument */
|
clexec = TRUE ; /* get the argument */
|
||||||
status = mlreply( "", tok, toksz) ;
|
status = gettokval( tok, toksz) ;
|
||||||
clexec = savcle; /* restore execution mode */
|
clexec = savcle ; /* restore execution mode */
|
||||||
return status;
|
return status ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
1
exec.h
1
exec.h
@ -20,7 +20,6 @@ int namedcmd( int f, int n) ;
|
|||||||
int execcmd( int f, int n) ;
|
int execcmd( int f, int n) ;
|
||||||
void gettoken( char *tok, int maxtoksize) ;
|
void gettoken( char *tok, int maxtoksize) ;
|
||||||
boolean gettokval( char *tok, int maxtoksize) ;
|
boolean gettokval( char *tok, int maxtoksize) ;
|
||||||
int macarg( char *tok, int toksz) ;
|
|
||||||
int storemac( int f, int n) ;
|
int storemac( int f, int n) ;
|
||||||
int execbuf( int f, int n) ;
|
int execbuf( int f, int n) ;
|
||||||
int execfile( int f, int n) ;
|
int execfile( int f, int n) ;
|
||||||
|
2
input.c
2
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 we are executing a command line get the next arg and match it */
|
||||||
if (clexec) {
|
if (clexec) {
|
||||||
if( macarg( buf, sizeof buf) != TRUE)
|
if( TRUE != gettokval( buf, sizeof buf))
|
||||||
return NULL;
|
return NULL;
|
||||||
return fncmatch(&buf[0]);
|
return fncmatch(&buf[0]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user