diff --git a/buffer.c b/buffer.c index 495fa93..8cffbaa 100644 --- a/buffer.c +++ b/buffer.c @@ -23,6 +23,20 @@ #include "window.h" +const char *modename[] = { /* name of modes */ + "Wrap", "Cmode", "Spell", "Exact", "View", "Over", + "Magic", +#if CRYPT + "Crypt", +#else + "", +#endif + "Asave", "Utf-8", "Dos" +} ; + +static const char modecode[] = "WCSEVOMYAUD" ; /* letters to represent modes */ + + static int makelist( int iflag) ; static int addline( char *text) ; static void ltoa( char *buf, int width, long num) ; @@ -296,9 +310,8 @@ static int makelist( int iflag) if ((s = bclear(blistp)) != TRUE) /* Blow old text away */ return s; strcpy(blistp->b_fname, ""); - if (addline("ACT MODES Size Buffer File") == FALSE - || addline("--- ----- ---- ------ ----") == - FALSE) + if( addline("ACT MODES Size Buffer File") == FALSE + || addline("--- ----- ---- ------ ----") == FALSE) return FALSE; bp = bheadp; /* For all buffers */ diff --git a/buffer.h b/buffer.h index 6eb70e3..41b2e4f 100644 --- a/buffer.h +++ b/buffer.h @@ -59,6 +59,9 @@ struct buffer { #define MDDOS 0x0400 /* CRLF eol mode */ +extern const char *modename[] ; /* text names of modes */ + + int usebuffer( int f, int n) ; int nextbuffer( int f, int n) ; int swbuffer( struct buffer *bp) ; diff --git a/display.c b/display.c index 0542849..9400a8b 100644 --- a/display.c +++ b/display.c @@ -1165,7 +1165,7 @@ static void modeline(struct window *wp) if (firstm != TRUE) strcat(tline, " "); firstm = FALSE; - strcat(tline, mode2name[i]); + strcat( tline, modename[ i]) ; } strcat(tline, ") "); diff --git a/edef.h b/edef.h index 10f2b08..821e456 100644 --- a/edef.h +++ b/edef.h @@ -28,9 +28,6 @@ extern char *execstr; /* pointer to string to execute */ extern int eolexist; /* does clear to EOL exist? */ extern int revexist; /* does reverse video exist? */ extern int flickcode; /* do flicker supression? */ -extern const char *modename[]; /* text names of modes */ -extern const char *mode2name[]; /* text names of modes */ -extern const char modecode[]; /* letters to represent modes */ extern int gmode; /* global editor mode */ extern int gflags; /* global control flag */ extern int gfcolor; /* global forgrnd color (white) */ diff --git a/estruct.h b/estruct.h index dd5b69a..60ff1b0 100644 --- a/estruct.h +++ b/estruct.h @@ -239,7 +239,6 @@ #define NPAT 128 /* # of bytes, pattern */ #define HUGE 1000 /* Huge number */ #define NLOCKS 100 /* max # of file locks active */ -#define NCOLORS 8 /* number of supported colors */ #define CONTROL 0x10000000 /* Control flag, or'ed in */ #define META 0x20000000 /* Meta flag, or'ed in */ diff --git a/globals.c b/globals.c index 19ac809..ee81dfe 100644 --- a/globals.c +++ b/globals.c @@ -13,30 +13,6 @@ char *execstr = NULL; /* pointer to string to execute */ int eolexist = TRUE; /* does clear to EOL exist */ int revexist = FALSE; /* does reverse video exist? */ int flickcode = FALSE; /* do flicker supression? */ -const char *modename[] = { /* name of modes */ - "WRAP", "CMODE", "SPELL", "EXACT", "VIEW", "OVER", - "MAGIC", -#if CRYPT - "CRYPT", -#else - "", -#endif - "ASAVE", "UTF-8", "DOS" -}; - -const char *mode2name[] = { /* name of modes */ - "Wrap", "Cmode", "Spell", "Exact", "View", "Over", - "Magic", -#if CRYPT - "Crypt", -#else - "", -#endif - "Asave", "utf-8", "Dos" -}; - -const char modecode[] = "WCSEVOMYAUD"; /* letters to represent modes */ - int gmode = 0; /* global editor mode */ int gflags = GFREAD; /* global control flag */ #if PKCODE & IBMPC diff --git a/random.c b/random.c index bee1088..be90bd0 100644 --- a/random.c +++ b/random.c @@ -24,7 +24,8 @@ #include "terminal.h" #include "window.h" -static const char *cname[] = { /* names of colors */ + +static const char *cname[] = { /* names of colors */ "BLACK", "RED", "GREEN", "YELLOW", "BLUE", "MAGENTA", "CYAN", "WHITE" #if PKCODE & IBMPC @@ -32,6 +33,9 @@ static const char *cname[] = { /* names of colors */ #endif } ; +#define NCOLORS (sizeof cname / sizeof( *cname)) /* # of supported colors */ + + int tabsize; /* Tab size (0: use real tabs) */ /* @@ -917,12 +921,8 @@ int delgmode(int f, int n) */ int adjustmode(int kind, int global) { - char *scan; /* scanning pointer to convert prompt */ int i; /* loop index */ int status; /* error return on input */ -#if COLOR - int uflag; /* was modename uppercase? */ -#endif char prompt[50]; /* string to prompt user with */ char cbuf[NPAT]; /* buffer to recieve mode name into */ @@ -943,28 +943,12 @@ int adjustmode(int kind, int global) if (status != TRUE) return status; - /* make it uppercase */ - - scan = cbuf; -#if COLOR - uflag = (*scan >= 'A' && *scan <= 'Z'); -#endif - while (*scan != 0) { - if (*scan >= 'a' && *scan <= 'z') - *scan = *scan - 32; - scan++; - } - /* test it first against the colors we know */ -#if PKCODE & IBMPC - for (i = 0; i <= NCOLORS; i++) { -#else for (i = 0; i < NCOLORS; i++) { -#endif - if (strcmp(cbuf, cname[i]) == 0) { + if( stricmp( cbuf, cname[ i]) == 0) { /* finding the match, we set the color */ #if COLOR - if (uflag) { + if( *cbuf >= 'A' && *cbuf <= 'Z') { if (global) gfcolor = i; #if PKCODE == 0 @@ -990,7 +974,7 @@ int adjustmode(int kind, int global) /* test it against the modes we know */ for (i = 0; i < NUMMODES; i++) { - if (strcmp(cbuf, modename[i]) == 0) { + if( stricmp( cbuf, modename[ i]) == 0) { /* finding a match, we process it */ if (kind == TRUE) if (global)