aboutsummaryrefslogtreecommitdiff
path: root/gdb/main.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1992-03-27 23:56:15 +0000
committerJohn Gilmore <gnu@cygnus>1992-03-27 23:56:15 +0000
commitc2e4669f8cc511833f293fdc03f6d63ee442bc9c (patch)
treed944a22860d9e589d4246341ba28c2a8afc35a64 /gdb/main.c
parent46f88c11388317086f7963b7ff3cfdd0aad48941 (diff)
downloadgdb-c2e4669f8cc511833f293fdc03f6d63ee442bc9c.zip
gdb-c2e4669f8cc511833f293fdc03f6d63ee442bc9c.tar.gz
gdb-c2e4669f8cc511833f293fdc03f6d63ee442bc9c.tar.bz2
Misc cleanups from code review.
Diffstat (limited to 'gdb/main.c')
-rw-r--r--gdb/main.c46
1 files changed, 16 insertions, 30 deletions
diff --git a/gdb/main.c b/gdb/main.c
index 8fc5d18..8543c3b 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1591,29 +1591,12 @@ validate_comname (comname)
p = comname;
while (*p)
{
- if (!(*p >= 'A' && *p <= 'Z')
- && !(*p >= 'a' && *p <= 'z')
- && !(*p >= '0' && *p <= '9')
- && *p != '-')
+ if (!isalnum(*p) && *p != '-')
error ("Junk in argument list: \"%s\"", p);
p++;
}
}
-#ifdef IBM6000
-
-lowercase (char *str)
-{
- while (*str) {
-
- /* isupper(), tolower() are function calls in AIX. */
- if ( *str >= 'A' && *str <= 'Z')
- *str = *str + 'a' - 'A';
- ++str;
- }
-}
-#endif
-
static void
define_command (comname, from_tty)
char *comname;
@@ -1625,14 +1608,6 @@ define_command (comname, from_tty)
validate_comname (comname);
-#ifdef IBM6000
-
- /* If the rest of the commands will be case insensetive, this one
- should behave in the same manner. */
-
- lowercase (comname);
-#endif
-
/* Look it up, and verify that we got an exact match. */
c = lookup_cmd (&tem, cmdlist, "", -1, 1);
if (c && 0 != strcmp (comname, c->name))
@@ -1644,17 +1619,23 @@ define_command (comname, from_tty)
tem = "Redefine command \"%s\"? ";
else
tem = "Really redefine built-in command \"%s\"? ";
- if (!query (tem, comname))
- error ("Command \"%s\" not redefined.", comname);
+ if (!query (tem, c->name))
+ error ("Command \"%s\" not redefined.", c->name);
}
+ comname = savestring (comname, strlen (comname));
+
+ /* If the rest of the commands will be case insensetive, this one
+ should behave in the same manner. */
+ for (tem = comname; *tem; tem++)
+ if (isupper(*tem)) *tem = tolower(*tem);
+
if (from_tty)
{
printf ("Type commands for definition of \"%s\".\n\
End with a line saying just \"end\".\n", comname);
fflush (stdout);
}
- comname = savestring (comname, strlen (comname));
cmds = read_command_lines ();
@@ -2028,8 +2009,13 @@ set_history_size_command (args, from_tty, c)
{
if (history_size == UINT_MAX)
unstifle_history ();
- else
+ else if (history_size >= 0)
stifle_history (history_size);
+ else
+ {
+ history_size = UINT_MAX;
+ error ("History size must be non-negative");
+ }
}
/* ARGSUSED */