* command.c, main.c (various places): Use ctype.h macros
authorPer Bothner <per@bothner.com>
Wed, 25 Mar 1992 23:07:16 +0000 (23:07 +0000)
committerPer Bothner <per@bothner.com>
Wed, 25 Mar 1992 23:07:16 +0000 (23:07 +0000)
(such as isupper(x)),  instead of hard-wiring in ASCII-isms
(such as (x >= 'A' && x <= 'Z')).
(There are still more of these in other files.)
* main.c (defined_command):  Lower-case the user's
new command before entering it.  Needed because
command lookup is case-insensitive (and also lower-cases).
(Based on Metin's earlier patch.)

gdb/ChangeLog
gdb/command.c

index 8855139f1e03232552033c6a8dc24467c9562405..5b60ed15e1cebe85e128fb11a1f60c9371909ec0 100644 (file)
@@ -1,3 +1,14 @@
+Wed Mar 25 14:55:48 1992  Per Bothner  (bothner@cygnus.com)
+
+       * command.c, main.c (various places):  Use ctype.h macros
+       (such as isupper(x)),  instead of hard-wiring in ASCII-isms
+       (such as (x >= 'A' && x <= 'Z')).
+       (There are still more of these in other files.)
+       * main.c (defined_command):  Lower-case the user's
+       new command before entering it.  Needed because
+       command lookup is case-insensitive (and also lower-cases).
+       (Based on Metin's earlier patch.)
+
 Tue Mar 24 23:27:01 1992  K. Richard Pixley  (rich@cygnus.com)
 
        * config/irix4.mh: new file.
index 4eed2a00d4c4e802272ae63eaa90675cebaa37bc..f39600ee0298d6ed1ea1f3334a59773b8519e03d 100644 (file)
@@ -535,7 +535,7 @@ lookup_cmd_1 (text, clist, result_list, ignore_help_classes)
   for (tmp = 0; tmp < len; tmp++)
     {
       char x = (*text)[tmp];
-      command[tmp] = (x >= 'A' && x <= 'Z') ? x - 'A' + 'a' : x;
+      command[tmp] = isupper(x) ? tolower(x) : x;
     }
   command[len] = '\0';
 
@@ -784,10 +784,7 @@ lookup_cmd (line, list, cmdtype, allow_unknown)
   /* Find end of command name.  */
 
   p = *line;
-  while (*p == '-'
-        || (*p >= 'a' && *p <= 'z')
-        || (*p >= 'A' && *p <= 'Z')
-        || (*p >= '0' && *p <= '9'))
+  while (*p == '-' || isalnum(*p))
     p++;
 
   /* Look up the command name.
@@ -812,8 +809,8 @@ lookup_cmd (line, list, cmdtype, allow_unknown)
   for (cmd_len = 0; cmd_len < p - *line; cmd_len++)
     {
       char x = (*line)[cmd_len];
-      if (x >= 'A' && x <= 'Z')
-       processed_cmd[cmd_len] = x - 'A' + 'a';
+      if (isupper(x))
+       processed_cmd[cmd_len] = tolower(x);
       else
        processed_cmd[cmd_len] = x;
     }
This page took 0.027342 seconds and 4 git commands to generate.