bin/176332: [patch] dc(1) - Properly handle '-h' argument

Glen Barber gjb at FreeBSD.org
Thu Feb 21 19:10:01 UTC 2013


>Number:         176332
>Category:       bin
>Synopsis:       [patch] dc(1) - Properly handle '-h' argument
>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:   Thu Feb 21 19:10:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Glen Barber
>Release:        10.0-CURRENT r246768
>Organization:
>Environment:
FreeBSD nucleus 10.0-CURRENT FreeBSD 10.0-CURRENT #60 r246768: Wed Feb 13 14:55:15 EST 2013     root at nucleus:/usr/obj/usr/src/sys/NUCLEUS  amd64

>Description:
dc(1) manual page advertises '-h' and '--help' as valid arguments, however 'h' is not in the getopt_long() list.

gjb at nucleus:~ % dc -h
dc: invalid option -- h
usage: dc [-hVx] [-e expression] [file]

>How-To-Repeat:

>Fix:
Patch is attached.

Patch attached with submission follows:

Index: usr.bin/dc/dc.c
===================================================================
--- usr.bin/dc/dc.c	(revision 247114)
+++ usr.bin/dc/dc.c	(working copy)
@@ -84,7 +84,7 @@
 	bool extended_regs = false, preproc_done = false;
 
 	/* accept and ignore a single dash to be 4.4BSD dc(1) compatible */
-	while ((ch = getopt_long(argc, argv, "e:f:Vx", long_options, NULL)) != -1) {
+	while ((ch = getopt_long(argc, argv, "e:f:hVx", long_options, NULL)) != -1) {
 		switch (ch) {
 		case 'e':
 			if (!preproc_done)


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list