Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Bernard A Badger" To: Subject: RE: trivial mkpasswd defect Date: Wed, 29 May 2002 17:45:35 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 > -----Original Message----- > From: Michael A Chase [mailto:mchase AT ix DOT netcom DOT com] > To: Bernard A Badger; cygwin AT cygwin DOT com > Subject: Re: trivial mkpasswd defect > On Wed, 29 May 2002 12:27:15 -0400 Bernard A Badger wrote: > > > > -----Original Message----- > > > On Wed, May 29, 2002 at 10:14:14AM -0400, Jon LaBadie wrote: > > > > mkpasswd reports '?' is a valid help option but fails to accept it. > > > > $ mkpasswd -? > > > > mkpasswd: unknown option -- ? > > > > > > Thanks. This will go away in the next version. > > > > I hope you mean that '-?' will work, not that '-?' will be taken out of the > > usage. > > In Unix envronments -h is more commonly used for help. '-?' as an option > is subject to filename expansion which can lead to odd behavior if it isn't > quoted. Well, the example from man 2 getopt has this: while ((c = getopt(argc, argv, ":abf:o:")) != -1) { switch(c) { .... case '?': fprintf(stderr, "Unrecognized option: -%c\n", optopt); errflg++; } } if (errflg) { fprintf(stderr, "usage: . . . "); exit(2); Which exemplifies the custom of printing the "usage" upon an error. Since '?' cannot be used as a getopt option, it is guaranteed to cause getopt to return '?' no matter what the option characters are. I saw this on a SGI Irix, and I checked at www.opengroup.org for the POSIX standard. Of course, if you're not following POSIX, and aren't using getopt, it may not work. Your personal experience of '-h' being a "help" option, probably carries less weight than the endorsement of POSIX ;-) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/