diff --git a/eval.c b/eval.c index 6d52ea4..de88f0f 100644 --- a/eval.c +++ b/eval.c @@ -763,7 +763,7 @@ int setvar(int f, int n) return status; } else { /* macro line argument */ /* grab token and skip it */ - execstr = token(execstr, var, NVSIZE + 1); + gettoken( var, sizeof var) ; } /* check the legality and find the var */ @@ -890,7 +890,7 @@ fvar: var[4] = 0; if (strcmp(&var[1], "ind") == 0) { /* grab token, and eval it */ - execstr = token(execstr, var, size); + gettoken( var, size) ; strcpy(var, getval(var)); goto fvar; } diff --git a/exec.c b/exec.c index 7b72a88..bd9ed90 100644 --- a/exec.c +++ b/exec.c @@ -27,7 +27,7 @@ #include "window.h" -char *execstr = NULL ; /* pointer to string to execute */ +static char *execstr = NULL ; /* pointer to string to execute */ boolean clexec = FALSE ; /* command line execution flag */ @@ -212,8 +212,7 @@ static int docmd( char *cline) { * char *src, *tok; source string, destination token string * int size; maximum size of token */ -char *token(char *src, char *tok, int size) -{ +static char *token( char *src, char *tok, int size) { int quotef; /* is the current string quoted? */ char c; /* temporary character */ @@ -279,6 +278,10 @@ char *token(char *src, char *tok, int size) return src; } +void gettoken( char *tok, int maxtoksize) { + execstr = token( execstr, tok, maxtoksize) ; +} + /* * get a macro line argument * @@ -312,7 +315,7 @@ int nextarg(const char *prompt, char *buffer, int size, int terminator) return getstring(prompt, buffer, size, terminator); /* grab token and advance past */ - execstr = token(execstr, buffer, size); + gettoken( buffer, size) ; /* evaluate it */ strncpy( buffer, getval( buffer), size - 1) ; diff --git a/exec.h b/exec.h index bddd85c..fb5f081 100644 --- a/exec.h +++ b/exec.h @@ -12,7 +12,6 @@ int execproc( int f, int n) ; #endif -extern char *execstr ; /* pointer to string to execute */ extern boolean clexec ; /* command line execution flag */ @@ -20,7 +19,7 @@ extern boolean clexec ; /* command line execution flag */ void ue_system( const char *cmd) ; int namedcmd( int f, int n) ; int execcmd( int f, int n) ; -char *token( char *src, char *tok, int size) ; +void gettoken( char *tok, int maxtoksize) ; int macarg( char *tok, int toksz) ; int nextarg( const char *prompt, char *buffer, int size, int terminator) ; int storemac( int f, int n) ;