Date: Sat, 28 Jan 2012 14:22:36 +0100 (CET) From: Klaus Aehlig <aehlig@linta.de> To: FreeBSD-gnats-submit@FreeBSD.org Cc: Gereon Kaiping <kta1c10!gereon@linta.de> Subject: bin/164570: [patch] pom(6) wrong usage message Message-ID: <20120128132236.6A5FB1CC1D@curry.linta.de> Resent-Message-ID: <201201281350.q0SDo60w017379@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 164570 >Category: bin >Synopsis: [patch] pom(6) wrong usage message >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 28 13:50:06 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Klaus Aehlig >Release: FreeBSD 8.2-STABLE amd64 >Organization: >Environment: System: FreeBSD curry.linta.de 8.2-STABLE FreeBSD 8.2-STABLE #15: Thu Jan 12 01:30:10 CET 2012 root@curry.linta.de:/usr/obj/usr/src/sys/CURRY amd64 >Description: For incorrect non-option arguments, pom(6) displays the first argument instead of the program name in the usage-message >How-To-Repeat: $ pom 1970.01.01 Usage: 1970.01.01 [-p] [-d yyyy.mm.dd] [-t hh:mm:ss] Would have expected Usage: pom [-p] [-d yyyy.mm.dd] [-t hh:mm:ss] or similar. >Fix: use the following patch --- patch-pom.c begins here --- --- pom.c.orig 2012-01-28 14:01:25.000000000 +0100 +++ pom.c 2012-01-28 14:06:12.000000000 +0100 @@ -90,6 +90,7 @@ double days, today, tomorrow; int ch, cnt, pflag = 0; char *odate = NULL, *otime = NULL; + char *progname = argv[0]; while ((ch = getopt(argc, argv, "d:pt:")) != -1) switch (ch) { @@ -103,14 +104,14 @@ otime = optarg; break; default: - usage(argv[0]); + usage(progname); } argc -= optind; argv += optind; if (argc) - usage(argv[0]); + usage(progname); /* Adjust based on users preferences */ time(&tt); --- patch-pom.c ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120128132236.6A5FB1CC1D>