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

Joerg Sonnenberger joerg at britannica.bec.de
Mon Mar 14 04:52:57 PST 2005


On Mon, Mar 14, 2005 at 01:09:36PM +0900, YONETANI Tomokazu wrote:
> 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().

You are right here. The fix for find is to specify '+' to prevent this
behaviour. For su, it depended on an undocumented feature of getopt(3)
and should be fixed now. I'll go through the other users of getopt(3)
today, but I don't expect major trouble for anything outside, since this
is the default behaviour of GNU's getopt.

Joerg





More information about the Commits mailing list