From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 7/8] Replace all usage errors with calls to error
Date: Wed, 06 Aug 2014 10:25:00 -0000 [thread overview]
Message-ID: <1407319948-2264-8-git-send-email-gbenson@redhat.com> (raw)
In-Reply-To: <1407319948-2264-1-git-send-email-gbenson@redhat.com>
This commit replaces the hardwired fprintf/exit error handlers
for usage errors with calls to error.
gdb/
2014-08-06 Gary Benson <gbenson@redhat.com>
* 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/main.c b/gdb/main.c
index 2f99157..a850edf 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -689,10 +689,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:
@@ -758,13 +755,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;
@@ -774,13 +766,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':
@@ -853,11 +840,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);
}
}
@@ -880,13 +864,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;
--
1.7.1
next prev parent reply other threads:[~2014-08-06 10:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 10:12 [PATCH 0/8] Error handling cleanups Gary Benson
2014-08-06 10:12 ` [PATCH 3/8] Make warning usable earlier Gary Benson
2014-08-06 10:12 ` [PATCH 8/8] Unify startup and option-parsing warnings Gary Benson
2014-08-06 10:12 ` [PATCH 4/8] Replace hardwired error handlers in tui_initialize_io Gary Benson
2014-08-06 10:12 ` [PATCH 2/8] Make error usable earlier Gary Benson
2014-08-06 10:25 ` Gary Benson [this message]
2014-08-06 10:25 ` [PATCH 5/8] Replace hardwired error handler in captured_main Gary Benson
2014-08-06 10:34 ` [PATCH 1/8] Make internal_vproblem always work Gary Benson
2014-08-06 10:52 ` [PATCH 6/8] Replace hardwired error handler in go32_create_inferior Gary Benson
2014-08-06 16:59 ` Eli Zaretskii
2014-08-08 11:38 ` Gary Benson
2014-08-28 14:09 ` [PATCH 0/8] Error handling cleanups Pedro Alves
2014-08-29 9:19 ` [COMMITTED PATCH " Gary Benson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1407319948-2264-8-git-send-email-gbenson@redhat.com \
--to=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox