portability touch-up (and ~15k size-savings)

Rich Felker dalias at aerifal.cx
Thu May 25 17:10:45 PDT 2006


On Thu, May 25, 2006 at 10:13:33PM +0200, Bernhard Fischer wrote:
> Not sure about the details (i.e. what *is* 'the reordering'? Never
> bothered to actually look ;) but aren't most of the applets relying on
> arbitrary ordering of the args?

It's a user reliance issue, not an app reliance issue. According to
POSIX, all options come before all non-option arguments, i.e.
"ls -l foo bar" instead of "ls foo bar -l". In the latter, "-l" is to
be interpreted as a filename and not an option. GNU ignores this
(unless POSIXLY_CORRECT env var is set) and internally modifies the
argv array in getopt/getopt_long so that you can write your programs
to assume non-options are at the end but they still accept options
anywhere.

Rich



More information about the busybox mailing list