Proposed argument changes to ntpq (fixing bug #319)

Gary E. Miller gem at rellim.com
Thu Jun 8 19:25:43 UTC 2017


Yo Eric!

On Thu, 8 Jun 2017 15:01:55 -0400
"Eric S. Raymond" <esr at thyrsus.com> wrote:

> Gary E. Miller via devel <devel at ntpsec.org>:
> > Yo Eric!
> > 
> > On Wed, 7 Jun 2017 22:46:42 -0400
> > "Eric S. Raymond" <esr at thyrsus.com> wrote:
> >   
> > > Gary E. Miller via devel <devel at ntpsec.org>:  
> > > > Just make the filename optional. So -l or -l filename    
> > > 
> > > Sadly, not practical with any varint of C or Python getopt. We'd
> > > have to roll our own, and that way madnes lies.  
> > 
> > man geetopt:
> > 
> > "If such a character is followed by a colon, the option requires an
> > argu‐ ment, so getopt() places a pointer to the following text in
> > the same argv-element, or the text of the following argv-element,
> > in optarg. Two colons mean an option takes an optional arg;"  
> 
> man getopt gets you the documentation of the *shell* getopt. Not
> useful here.

Correct, I actually did 'man -a getopt' which shows both getopt(1) and
getopt(3).  I hard code the -a into my 'man'.  My snippet was from
getopt(3p).

> Mind you I didn't know it had this capability, so I learned something.

Well, more to be learned, my getopt(3p) is not the same as what I see on
unix.com.  The online copy did not include the snippet I quoted.  You
can confirm on the POSIX site for getopt(3P):

http://www.unix.com/man-page/posix/3p/getopt/

But they both had this snippet:

"A <colon> (':') shall be returned if getopt() detects a missing
argument and the first character of optstring was a <colon> (':')."

So optional optarg can be valid POXIX.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20170608/c376ef1d/attachment.bin>


More information about the devel mailing list