--- src/packlib/kuip/code_kuip/kuwhat.c.old 2003-01-19 00:51:48.000000000 +0100
+++ src/packlib/kuip/code_kuip/kuwhat.c 2003-01-19 19:44:41.000000000 +0100
@@ -1038,13 +1038,14 @@
char *format_prompt( const char *prompt )
{
static char *curr_prompt = NULL;
+ static const char *Kuip_prompt = "Kuip >";
char *p;
if( curr_prompt != NULL )
free( curr_prompt );
if( prompt == NULL)
- prompt = "Kuip >";
+ prompt = Kuip_prompt;
curr_prompt = strdup( prompt );
if( (p = strstr( curr_prompt, "[]" )) != NULL ) {
@@ -1290,14 +1291,15 @@
*/
int kxdollar()
{
+ static const char *ON = "ON", *OFF = "OFF";
char *which = ku_getc();
ku_alfa();
- if( strcmp( which, "ON" ) == 0 ) {
+ if( strcmp( which, ON ) == 0 ) {
kc_flags.try_getenv = 1;
}
- else if( strcmp( which, "OFF" ) == 0 ) {
+ else if( strcmp( which, OFF ) == 0 ) {
kc_flags.try_getenv = 0;
}
else if( kc_flags.try_getenv ) {
@@ -1307,7 +1309,7 @@
printf( " $var is not tried as being an environment variable.\n" );
}
- kc_value.set_dollar = kc_flags.try_getenv ? "ON" : "OFF";
+ kc_value.set_dollar = kc_flags.try_getenv ? ON : OFF;
return 0;
}
@@ -1319,15 +1321,16 @@
int kxfilecase()
{
static int old_fcase = 0;
+ static const char *KEEP = "KEEP", *CONVERT = "CONVERT";
char *fcase = ku_getc();
ku_alfa();
- if( strcmp( fcase, "KEEP" ) == 0 ) {
+ if( strcmp( fcase, KEEP ) == 0 ) {
old_fcase = kc_flags.keep_fcase;
kc_flags.keep_fcase = 1;
}
- else if( strcmp( fcase, "CONVERT" ) == 0 ) {
+ else if( strcmp( fcase, CONVERT ) == 0 ) {
old_fcase = kc_flags.keep_fcase;
kc_flags.keep_fcase = 0;
}
@@ -1341,7 +1344,7 @@
printf( " Filenames ARE case converted.\n" );
}
- kc_value.set_filecase = kc_flags.keep_fcase ? "KEEP" : "CONVERT";
+ kc_value.set_filecase = kc_flags.keep_fcase ? KEEP : CONVERT;
return 0;
}
@@ -1391,13 +1394,14 @@
int kxrecallstyle()
{
static char *styles[] = { "KSH", "KSHO", "DCL", "DCLO" };
+ static const char *NONE = "NONE";
static int gl_mask = 0;
char *style = ku_getc();
ku_alfa();
- if( strcmp( style, "NONE" ) == 0 ) {
- kc_value.set_recall_style = "NONE";
+ if( strcmp( style, NONE ) == 0 ) {
+ kc_value.set_recall_style = NONE;
kc_window.use_getline = 0;
}
else if( strcmp( style, styles[0] ) == 0 ) {
@@ -1424,7 +1428,7 @@
if( kc_window.use_getline )
style = styles[gl_mask];
else
- style = "NONE";
+ style = NONE;
printf( " Current recall style is %s\n", style );
return 0;
}
@@ -1883,6 +1887,7 @@
const char *line )
{
char *prompt = str2dup( question, " " );
+ static const char *Go = "Go";
int n;
if( line != NULL )
@@ -1910,7 +1915,7 @@
gl_config( "erase", 0 );
#endif
if( answer == NULL )
- answer = "Go";
+ answer = Go;
switch( answer[0] ) {
default:
--- src/packlib/kuip/code_kuip/kmenu.c.old 2003-01-20 14:02:26.000000000 +0100
+++ src/packlib/kuip/code_kuip/kmenu.c 2003-01-22 13:56:17.000000000 +0100
@@ -775,6 +775,7 @@
int status;
if( npar >= 2 ) {
+ static const char *EDIT = "-EDIT", *NOEDIT = "-NOEDIT";
char *view = ku_getc();
if( strcmp( view, "E" ) == 0 || strcmp( view, "EDIT" ) == 0 )
@@ -782,7 +783,7 @@
else
edit_mode = 0;
- kc_value.help_edit = edit_mode ? "-EDIT" : "-NOEDIT";
+ kc_value.help_edit = edit_mode ? EDIT : NOEDIT;
if( path[0] == '\0' )
return 0;
@@ -848,12 +849,13 @@
strcmp( view, "-E" ) == 0 || strcmp( view, "-EDIT" ) == 0 ||
strcmp( view, "N" ) == 0 || strcmp( view, "NOEDIT" ) == 0 ||
strcmp( view, "-N" ) == 0 || strcmp( view, "-NOEDIT" ) == 0 ) {
+ static const char *EDIT = "-EDIT", *NOEDIT = "-NOEDIT";
if( strcmp( view, "E" ) == 0 || strcmp( view, "EDIT" ) == 0 ||
strcmp( view, "-E" ) == 0 || strcmp( view, "-EDIT" ) == 0 )
edit_mode = 1;
else
edit_mode = 0;
- kc_value.help_edit = edit_mode ? "-EDIT" : "-NOEDIT";
+ kc_value.help_edit = edit_mode ? EDIT : NOEDIT;
} else if( strcmp( view, "K" ) == 0 || strcmp( view, "KEYWORD" ) == 0 ||
strcmp( view, "-K" ) == 0 || strcmp( view, "-KEYWORD" ) == 0 ) {
key_mode = 1;
@@ -2447,6 +2449,7 @@
}
else if( cmd != NULL ) {
/* return next command */
+ static const char *Cmd = "Cmd", *InvCmd = "InvCmd";
int len = 0;
int i;
ltext[0] = '\0';
@@ -2466,7 +2469,7 @@
sprintf( <ext[len], " ]" );
}
obj_desc[0] = cmd->name;
- obj_desc[1] = cmd->hidden ? "InvCmd" : "Cmd";
+ obj_desc[1] = cmd->hidden ? InvCmd : Cmd;
obj_desc[2] = cmd->path;
obj_desc[3] = ltext;
cmd = cmd->next;