From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8500 invoked by alias); 6 Aug 2014 10:25:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 8438 invoked by uid 89); 6 Aug 2014 10:25:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 06 Aug 2014 10:25:12 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76ACbkp019227 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 06:12:37 -0400 Received: from blade.nx (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76ACaSR014743 for ; Wed, 6 Aug 2014 06:12:37 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 5E6DC2640E4 for ; Wed, 6 Aug 2014 11:12:35 +0100 (BST) From: Gary Benson 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 Message-Id: <1407319948-2264-8-git-send-email-gbenson@redhat.com> In-Reply-To: <1407319948-2264-1-git-send-email-gbenson@redhat.com> References: <1407319948-2264-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00076.txt.bz2 This commit replaces the hardwired fprintf/exit error handlers for usage errors with calls to error. gdb/ 2014-08-06 Gary Benson * 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