From 91b35fd05c777ffba9b1738711d470977779c687 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Tue, 5 Aug 2014 16:12:01 +0100 Subject: Replace all usage errors with calls to error 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 | 4 ++++ gdb/main.c | 40 ++++++++++------------------------------ 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dd5e080..3c2b114 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2014-08-29 Gary Benson + * main.c (captured_main): Handle usage errors with error. + +2014-08-29 Gary Benson + * go32-nat.c (go32_create_inferior): Replace a fprintf/ exit pair with a call to error. Wrap the message with _(). diff --git a/gdb/main.c b/gdb/main.c index 415b900..d2e3d5e 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -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; -- cgit v1.1