* Rename remote-es1800.c to remote-es.c
[deliverable/binutils-gdb.git] / gdb / main.c
index 1976a5d43beef38be022f320af1208af21c9d950..9706105ac4413f5fdad1e6185263645967124780 100644 (file)
@@ -169,7 +169,8 @@ source_cleanup PARAMS ((FILE *));
 #ifndef        GDBINIT_FILENAME
 #define        GDBINIT_FILENAME        ".gdbinit"
 #endif
-char gdbinit[] = GDBINIT_FILENAME;
+static char gdbinit[] = GDBINIT_FILENAME;
+static int inhibit_gdbinit = 0;
 
 #define        ALL_CLEANUPS    ((struct cleanup *)0)
 
@@ -384,7 +385,8 @@ static void
 disconnect (signo)
 int signo;
 {
-  catch_errors (quit_cover, NULL, "Could not kill inferior process");
+  catch_errors (quit_cover, NULL,
+               "Could not kill the program being debugged");
   signal (SIGHUP, SIG_DFL);
   kill (getpid (), SIGHUP);
 }
@@ -431,7 +433,6 @@ main (argc, argv)
      char **argv;
 {
   int count;
-  static int inhibit_gdbinit = 0;
   static int quiet = 0;
   static int batch = 0;
 
@@ -757,7 +758,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
 
   if (execarg != NULL
       && symarg != NULL
-      && strcmp (execarg, symarg) == 0)
+      && STREQ (execarg, symarg))
     {
       /* The exec file and the symbol-file are the same.  If we can't open
         it, better only print one error message.  */
@@ -898,7 +899,6 @@ execute_command (p, from_tty)
      int from_tty;
 {
   register struct cmd_list_element *c;
-  register struct command_line *cmdlines;
   register enum language flang;
   static int warned = 0;
 
@@ -1455,7 +1455,7 @@ command_line_input (prrompt, repeat)
   }
 
 #ifdef STOP_SIGNAL
-  signal (SIGTSTP, SIG_DFL);
+  signal (STOP_SIGNAL, SIG_DFL);
 #endif
   immediate_quit--;
 
@@ -1768,7 +1768,7 @@ define_command (comname, from_tty)
 
   /* 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))
+  if (c && !STREQ (comname, c->name))
     c = 0;
     
   if (c)
@@ -1790,7 +1790,7 @@ define_command (comname, from_tty)
       /* Look up cmd it hooks, and verify that we got an exact match.  */
       tem = comname+HOOK_LEN;
       hookc = lookup_cmd (&tem, cmdlist, "", -1, 0);
-      if (hookc && 0 != strcmp (comname+HOOK_LEN, hookc->name))
+      if (hookc && !STREQ (comname+HOOK_LEN, hookc->name))
        hookc = 0;
       if (!hookc)
        {
@@ -1894,7 +1894,7 @@ print_gdb_version (stream)
   FILE *stream;
 {
   fprintf_filtered (stream, "\
-GDB %s, Copyright 1992 Free Software Foundation, Inc.",
+GDB %s, Copyright 1993 Free Software Foundation, Inc.",
          version);
 }
 
@@ -1927,15 +1927,20 @@ quit_command (args, from_tty)
 {
   if (inferior_pid != 0 && target_has_execution)
     {
-      if (query ("The program is running.  Quit anyway? "))
+      if (attach_flag)
        {
-         if (attach_flag)
+         if (query ("The program is running.  Quit anyway (and detach it)? "))
            target_detach (args, from_tty);
          else
-           target_kill ();
+           error ("Not confirmed.");
        }
       else
-       error ("Not confirmed.");
+       {
+         if (query ("The program is running.  Quit anyway (and kill it)? "))
+           target_kill ();
+         else
+           error ("Not confirmed.");
+       }
     }
   /* Save the history information if it is appropriate to do so.  */
   if (write_history_p && history_filename)
@@ -1961,7 +1966,7 @@ pwd_command (args, from_tty)
   if (args) error ("The \"pwd\" command does not take an argument: %s", args);
   getcwd (dirbuf, sizeof (dirbuf));
 
-  if (strcmp (dirbuf, current_directory))
+  if (!STREQ (dirbuf, current_directory))
     printf ("Working directory %s\n (canonically %s).\n",
            current_directory, dirbuf);
   else
@@ -2044,14 +2049,15 @@ source_command (args, from_tty)
   struct cleanup *cleanups;
   char *file = args;
 
-  if (file == 0)
-    /* Let source without arguments read .gdbinit.  */
-    file = gdbinit;
+  if (file == NULL)
+    {
+      error ("source command requires pathname of file to source.");
+    }
 
   file = tilde_expand (file);
   make_cleanup (free, file);
 
-  stream = fopen (file, "r");
+  stream = fopen (file, FOPEN_RT);
   if (stream == 0)
     perror_with_name (file);
 
@@ -2072,7 +2078,7 @@ echo_command (text, from_tty)
   register int c;
 
   if (text)
-    while (c = *p++)
+    while ((c = *p++) != '\0')
       {
        if (c == '\\')
          {
@@ -2185,13 +2191,13 @@ set_history_size_command (args, from_tty, c)
      int from_tty;
      struct cmd_list_element *c;
 {
-  if (history_size == UINT_MAX)
+  if (history_size == INT_MAX)
     unstifle_history ();
   else if (history_size >= 0)
     stifle_history (history_size);
   else
     {
-      history_size = UINT_MAX;
+      history_size = INT_MAX;
       error ("History size must be non-negative");
     }
 }
@@ -2248,6 +2254,7 @@ int signo;
 {
   /* This message is based on ANSI C, section 4.7.  Note that integer
      divide by zero causes this, so "float" is a misnomer.  */
+  signal (SIGFPE, float_handler);
   error ("Erroneous arithmetic operation.");
 }
 
@@ -2453,7 +2460,7 @@ Use \"on\" to enable to enable the saving, and \"off\" to disable it.\n\
 Without an argument, saving is enabled.", &sethistlist),
      &showhistlist);
 
-  c = add_set_cmd ("size", no_class, var_uinteger, (char *)&history_size,
+  c = add_set_cmd ("size", no_class, var_integer, (char *)&history_size,
                   "Set the size of the command history, \n\
 ie. the number of previous commands to keep a record of.", &sethistlist);
   add_show_from_set (c, &showhistlist);
This page took 0.026295 seconds and 4 git commands to generate.