This getopt implementation came from the NetBSD sources.

Specifically, getopt.c and getopt_long.c came from:
/afs/sipb.mit.edu/project/netbsd/src/lib/libc/stdlib.

They were slightly modified.  The header file was manually created.
This is the same implementation that was added to the MIT Kerbeos 5
release 1.2.
