cvs commit: src/lib/libc/stdlib Makefile.inc getopt_long.3 getopt_long.c

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Sun Mar 13 20:10:27 PST 2005


On Mon, Mar 14, 2005 at 11:55:00AM +0900, YONETANI Tomokazu wrote:
> On Sun, Mar 13, 2005 at 12:13:41PM -0800, Joerg Sonnenberger wrote:
> > joerg       2005/03/13 12:13:41 PST
> > 
> > DragonFly src repository
> > 
> >   Modified files:
> >     lib/libc/stdlib      Makefile.inc getopt_long.3 getopt_long.c 
> >   Log:
> >   Use getopt_long's getopt implementation.
> >   
> >   Revision  Changes    Path
> >   1.9       +1 -1      src/lib/libc/stdlib/Makefile.inc
> >   1.2       +0 -4      src/lib/libc/stdlib/getopt_long.3
> >   1.10      +0 -4      src/lib/libc/stdlib/getopt_long.c
> > 
> > 
> > http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdlib/Makefile.inc.diff?r1=1.8&r2=1.9&f=u
> > http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdlib/getopt_long.3.diff?r1=1.1&r2=1.2&f=u
> > http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdlib/getopt_long.c.diff?r1=1.9&r2=1.10&f=u
> 
> I haven't tracked anything down, but this seems to break something
> in the handling of short option; for example, `su' succeeds but `su -'
> fails and displays usage.

This is what I've found so far:
- traditional getopt() accepts a single hyphen alone as an option,
  whereas getopt_internal() doesn't. su(8) expects this behavior.
- traditional getopt() does not parse beyond non-option arguments,
  but getopt_internal() does. find(1) expects getopt() to stop
  looking for options when it encountered the list of pathname.

While being able to place options after non-option arguments are useful,
doing so requires rewrite of commands using getopt().





More information about the Commits mailing list