POSIX update and cleanups for getopt(3):
authorHiten Pandya <hmp@dragonflybsd.org>
Thu, 15 Jul 2004 04:10:33 +0000 (04:10 +0000)
committerHiten Pandya <hmp@dragonflybsd.org>
Thu, 15 Jul 2004 04:10:33 +0000 (04:10 +0000)
commit42a4cbd9acaeee7f105704842b5ba26eed0ac151
tree7753862597a9c7c6822abf3e5990d51865483b45
parent19ab3d9d872046ccb5fe4c89f74ab4d6602ba78d
POSIX update and cleanups for getopt(3):

o use getprogname(3) instead of using __progname directly;
  the latter should only be used by {gs}etprogname(3).

o handle strings with '--' correctly; this will display a
  meaningful error when doing 'ls --color -l'.

o correct behaviour with regard to POSIX; i.e., an error
  message should be printed when the bad option is '?'.

Tested with 'buildworld' and 'installworld'; with and without
the change.

Obtained from FreeBSD and NetBSD.
lib/libc/stdlib/getopt.c