Move global string literal to eval.

This commit is contained in:
Renaud 2013-09-29 14:07:53 +08:00
parent 2a34d732c5
commit d0a5516da6
4 changed files with 15 additions and 13 deletions

5
edef.h
View File

@ -71,14 +71,9 @@ extern kbdstate kbdmode ; /* current keyboard macro mode */
extern int kbdrep; /* number of repetitions */
extern int restflag; /* restricted use? */
extern int lastkey; /* last keystoke */
extern int seed; /* random number seed */
extern long envram; /* # of bytes current in use by malloc */
extern int macbug; /* macro debuging flag */
extern char errorm[]; /* error literal */
extern char truem[]; /* true literal */
extern char falsem[]; /* false litereal */
extern int cmdstatus; /* last command status */
extern char palstr[]; /* palette string */
extern int saveflag; /* Flags, saved with the $target var */
extern int rval; /* return value of a subprocess */
extern int overlap; /* line overlap in forw/back page */

17
eval.c
View File

@ -41,6 +41,12 @@ struct user_variable {
char *u_value; /* value (string) */
};
static char errorm[] = "ERROR" ; /* error literal */
static int seed = 0 ; /* random number seed */
static char *ltos( int val) ;
/* List of recognized environment variables. */
static const char *envars[] = {
@ -494,8 +500,12 @@ char *gtenv(char *vname)
return ltos(macbug);
case EVSTATUS:
return ltos(cmdstatus);
case EVPALETTE:
case EVPALETTE: {
static char palstr[ 49] = "" ; /* palette string */
return palstr;
}
case EVASAVE:
return itoa(gasave);
case EVACOUNT:
@ -1089,8 +1099,11 @@ int stol(char *val)
*
* int val; value to translate
*/
char *ltos(int val)
static char *ltos( int val)
{
static char truem[] = "TRUE" ; /* true literal */
static char falsem[] = "FALSE" ; /* false literal */
if (val)
return truem;
else

1
eval.h
View File

@ -25,7 +25,6 @@ int setvar( int f, int n) ;
char *itoa( int i) ;
char *getval( char *token) ;
int stol( char *val) ;
char *ltos( int val) ;
char *mkupper( char *str) ;
char *mklower( char *str) ;
int abs( int x) ;

View File

@ -72,14 +72,9 @@ kbdstate kbdmode = STOP; /* current keyboard macro mode */
int kbdrep = 0; /* number of repetitions */
int restflag = FALSE; /* restricted use? */
int lastkey = 0; /* last keystoke */
int seed = 0; /* random number seed */
long envram = 0l; /* # of bytes current in use by malloc */
int macbug = FALSE; /* macro debuging flag */
char errorm[] = "ERROR"; /* error literal */
char truem[] = "TRUE"; /* true literal */
char falsem[] = "FALSE"; /* false litereal */
int cmdstatus = TRUE; /* last command status */
char palstr[49] = ""; /* palette string */
int saveflag = 0; /* Flags, saved with the $target var */
int rval = 0; /* return value of a subprocess */
int overlap = 0; /* line overlap in forw/back page */