>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 r...@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:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to