[Bug 5612] --help returns an error code

bugzilla at busybox.net bugzilla at busybox.net
Fri Feb 1 15:13:40 UTC 2013


--- Comment #2 from Tim Marston <ra00103 at waxworlds.org> 2013-02-01 15:14:02 UTC ---
OK, that's a good point.

I was trying to determine, in a Makefile, whether stty accepts a '-F' argument
(GNU, busybox) or '-f' argument (BSD/OSX).  The test I had been doing was to
assume that if the command supported --help (i.e., GNU long options), it would
also support -F:

  stty --help > /dev/null 2>&1 && echo -F || echo -f

But this doesn't work for busybox.  So I now using a test that defaults to -F
unless I can detect an explicit and specific error message from --help:

  stty --help 2>&1 | grep -q 'illegal option' && echo -f || echo -F

I realise these are both horrible and entirely unsupported ways of determining
command line arguments, but I couldn't think of a nice way that would be
suitable for use in a Makefile.

With regard to the exit code of --help, I still think that it would be nice if
busybox returned 0, if only for consistency.  But I accept your point entirely.

Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the busybox-cvs mailing list