Replace all usage errors with calls to error
authorGary Benson <gbenson@redhat.com>
Tue, 5 Aug 2014 15:12:01 +0000 (16:12 +0100)
committerGary Benson <gbenson@redhat.com>
Fri, 29 Aug 2014 09:12:04 +0000 (10:12 +0100)
This commit replaces the hardwired fprintf/exit error handlers
for usage errors with calls to error.

gdb/ChangeLog:

* main.c (captured_main): Handle usage errors with error.

gdb/ChangeLog
gdb/main.c

index dd5e080a6791bc68208e9c02bfb5b146e67b023a..3c2b114256605a7e00768976b73e152f3563b097 100644 (file)
@@ -1,3 +1,7 @@
+2014-08-29  Gary Benson  <gbenson@redhat.com>
+
+       * main.c (captured_main): Handle usage errors with error.
+
 2014-08-29  Gary Benson  <gbenson@redhat.com>
 
        * go32-nat.c (go32_create_inferior): Replace a fprintf/
index 415b90055310625dfcaf76eb1f6e26ff5d3e5f8d..d2e3d5e5be7dc7e123db2d2a88951655d92b4f25 100644 (file)
@@ -687,10 +687,7 @@ captured_main (void *data)
            xfree (interpreter_p);
            interpreter_p = xstrdup (INTERP_TUI);
 #else
-           fprintf_unfiltered (gdb_stderr,
-                               _("%s: TUI mode is not supported\n"),
-                               argv[0]);
-           exit (1);
+           error (_("%s: TUI mode is not supported"), gdb_program_name);
 #endif
            break;
          case OPT_WINDOWS:
@@ -756,13 +753,8 @@ captured_main (void *data)
            break;
          case 'D':
            if (optarg[0] == '\0')
-             {
-               fprintf_unfiltered (gdb_stderr,
-                                   _("%s: empty path for"
-                                     " `--data-directory'\n"),
-                                   argv[0]);
-               exit (1);
-             }
+             error (_("%s: empty path for `--data-directory'"),
+                    gdb_program_name);
            set_gdb_data_directory (optarg);
            gdb_datadir_provided = 1;
            break;
@@ -772,13 +764,8 @@ captured_main (void *data)
              extern int gdbtk_test (char *);
 
              if (!gdbtk_test (optarg))
-               {
-                 fprintf_unfiltered (gdb_stderr,
-                                     _("%s: unable to load "
-                                       "tclcommand file \"%s\""),
-                                     argv[0], optarg);
-                 exit (1);
-               }
+               error (_("%s: unable to load tclcommand file \"%s\""),
+                      gdb_program_name, optarg);
              break;
            }
          case 'y':
@@ -851,11 +838,8 @@ captured_main (void *data)
            break;
 
          case '?':
-           fprintf_unfiltered (gdb_stderr,
-                               _("Use `%s --help' for a "
-                                 "complete list of options.\n"),
-                               argv[0]);
-           exit (1);
+           error (_("Use `%s --help' for a complete list of options."),
+                  gdb_program_name);
          }
       }
 
@@ -878,13 +862,9 @@ captured_main (void *data)
         inferior.  The first one is the sym/exec file, and the rest
         are arguments.  */
       if (optind >= argc)
-       {
-         fprintf_unfiltered (gdb_stderr,
-                             _("%s: `--args' specified but "
-                               "no program specified\n"),
-                             argv[0]);
-         exit (1);
-       }
+       error (_("%s: `--args' specified but no program specified"),
+              gdb_program_name);
+
       symarg = argv[optind];
       execarg = argv[optind];
       ++optind;