From patchwork Wed Dec 21 20:39:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horst Kronstorfer X-Patchwork-Id: 132735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3A515B7132 for ; Thu, 22 Dec 2011 08:30:48 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AC81A280BE; Wed, 21 Dec 2011 22:30:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NM7PUyLBM138; Wed, 21 Dec 2011 22:30:44 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BE20D280B3; Wed, 21 Dec 2011 22:30:42 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7A512280B3 for ; Wed, 21 Dec 2011 22:30:40 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v3+2548X0D3P for ; Wed, 21 Dec 2011 22:30:38 +0100 (CET) X-Greylist: delayed 3044 seconds by postgrey-1.27 at theia; Wed, 21 Dec 2011 22:30:36 CET X-policyd-weight: IN_SBL_XBL_SPAMHAUS=4.35 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from m3f4.kronos.net (178-190-65-114.adsl.highway.telekom.at [178.190.65.114]) by theia.denx.de (Postfix) with ESMTPS id 9C44C280B2 for ; Wed, 21 Dec 2011 22:30:36 +0100 (CET) Received: from m3f4.kronos.net (m3f4.kronos.net [127.0.0.1]) by m3f4.kronos.net (8.14.5/8.14.5) with ESMTP id pBLKdgEt005022; Wed, 21 Dec 2011 21:39:42 +0100 Received: (from mabuze@localhost) by m3f4.kronos.net (8.14.5/8.14.5/Submit) id pBLKdeTS005021; Wed, 21 Dec 2011 21:39:40 +0100 From: Horst Kronstorfer To: u-boot@lists.denx.de Date: Wed, 21 Dec 2011 21:39:39 +0100 Message-Id: <1324499979-4978-1-git-send-email-hkronsto@frequentis.com> X-Mailer: git-send-email 1.7.7.4 In-Reply-To: <1324469157-18032-1-git-send-email-hkronsto@frequentis.com> References: <1324469157-18032-1-git-send-email-hkronsto@frequentis.com> Subject: [U-Boot] [PATCH, v3] Print program basename instead of whole path in usage() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Horst Kronstorfer --- Changes for v2: - Use the GNU version of basename(). - Rebase against branch 'next.' Changes for v3: - Rebase against branch 'master.' tools/mkenvimage.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index 9c32f4a..3bb471d 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -25,6 +25,9 @@ * MA 02111-1307 USA */ +/* We want the GNU version of basename() */ +#define _GNU_SOURCE + #include #include #include @@ -79,6 +82,9 @@ int main(int argc, char **argv) struct stat txt_file_stat; int fp, ep; + const char *prg; + + prg = basename(argv[0]); /* Parse the cmdline */ while ((option = getopt(argc, argv, "s:o:rbp:h")) != -1) { @@ -104,11 +110,11 @@ int main(int argc, char **argv) padbyte = strtol(optarg, NULL, 0); break; case 'h': - usage(argv[0]); + usage(prg); return EXIT_SUCCESS; default: fprintf(stderr, "Wrong option -%c\n", option); - usage(argv[0]); + usage(prg); return EXIT_FAILURE; } } @@ -118,7 +124,7 @@ int main(int argc, char **argv) fprintf(stderr, "Please specify the size of the envrionnment " "partition.\n"); - usage(argv[0]); + usage(prg); return EXIT_FAILURE; }