* stabsread.c (get_substring): Declare second arg as int.
[deliverable/binutils-gdb.git] / gdb / command.c
index 0362328aea7b26f391f068669eb991290efdf7ee..9afbf82e59a5920c5b20c60f3f37a58f1e2563cf 100644 (file)
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "gdbcmd.h"
 #include "symtab.h"
 #include "value.h"
+#include "wait.h"
 #include <ctype.h>
 #include "gdb_string.h"
 #ifdef HAVE_UNISTD_H
@@ -79,18 +80,19 @@ add_cmd (name, class, fun, doc, list)
   c->class = class;
   c->function.cfunc = fun;
   c->doc = doc;
-  c->prefixlist = 0;
-  c->prefixname = (char *)NULL;
+  c->hook = NULL;
+  c->prefixlist = NULL;
+  c->prefixname = NULL;
   c->allow_unknown = 0;
-  c->hook = 0;
-  c->hookee = 0;
-  c->cmd_pointer = 0;
   c->abbrev_flag = 0;
-  c->type = not_set_cmd;
   c->completer = make_symbol_completion_list;
-  c->var = 0;
+  c->type = not_set_cmd;
+  c->var = NULL;
   c->var_type = var_boolean;
-  c->user_commands = 0;
+  c->enums = NULL;
+  c->user_commands = NULL;
+  c->hookee = NULL;
+  c->cmd_pointer = NULL;
   *list = c;
   return c;
 }
@@ -1047,7 +1049,7 @@ complete_on_enum (enumlist, text, word)
   matchlist = (char **) xmalloc (sizeof_matchlist * sizeof (char *));
   matches = 0;
 
-  for (i = 0; name = enumlist[i]; i++)
+  for (i = 0; (name = enumlist[i]) != NULL; i++)
     if (strncmp (name, text, textlen) == 0)
       {
        if (matches == sizeof_matchlist)
@@ -1271,9 +1273,11 @@ do_setshow_command (arg, from_tty, c)
       case var_string:
        {
          unsigned char *p;
+
          fputs_filtered ("\"", gdb_stdout);
-         for (p = *(unsigned char **) c->var; *p != '\0'; p++)
-           gdb_printchar (*p, gdb_stdout, '"');
+         if (*(unsigned char **)c->var)
+           for (p = *(unsigned char **) c->var; *p != '\0'; p++)
+             gdb_printchar (*p, gdb_stdout, '"');
          fputs_filtered ("\"", gdb_stdout);
        }
        break;
@@ -1281,7 +1285,8 @@ do_setshow_command (arg, from_tty, c)
       case var_filename:
       case var_enum:
        fputs_filtered ("\"", gdb_stdout);
-       fputs_filtered (*(char **) c->var, gdb_stdout);
+       if (*(char **)c->var)
+         fputs_filtered (*(char **) c->var, gdb_stdout);
        fputs_filtered ("\"", gdb_stdout);
        break;
       case var_boolean:
This page took 0.024185 seconds and 4 git commands to generate.