Subject: Re: bin/34074: remove uneeded case's
To: None <gnats-bugs@NetBSD.org>
From: Simon Burge <simonb@NetBSD.org>
List: netbsd-bugs
Date: 07/25/2006 14:49:32
new.security@gmail.com wrote:

> >Number:         34074
> >Category:       bin
> >Synopsis:       remove uneeded case's
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       low
> >Responsible:    bin-bug-people
> >State:          open
> >Class:          change-request
> >Submitter-Id:   net
> >Arrival-Date:   Tue Jul 25 04:20:00 +0000 2006
> >Originator:     Kevin Massey
> >Release:        
> >Organization:
> >Environment:
> >Description:
> many times case '?' is used right before default: and it is not needed.
> >How-To-Repeat:

Note that getopt(3) returns '?' for an unknown option or error with
an option that is expecting an argument.  The example in getopt(3)
has:

             case '?':
             default:
                     usage();


It's also interesting to note that the SUSv3 (close to Posix) example
code doesn't even have the "default:" case label and just uses
"case '?':".

I'm not sure if I consider this PR a bug or not, or if it is a bug
then should we follow the SUSv3 example?  If anything does change,
getopt(3) should be updated too to reflect this.

Personally, I'd be tempted to leave things as they are ... I think!

Simon.