On Tue, Aug 17, 2010 at 09:36:14PM +0200, Alexander Teinum wrote:
> It would be a nice challenge to write a really small getopt()
> replacement, and a program that generates usage text.

Check getflags(8)[1], it parse options and generate usage messages for
rc scripts.

For C there are ARGBEGIN, ARGEND[2] and other macros.  They don't
generate usage, but they solve another problem of getopt(): you don't
have to check that the string that you pass to getopt() lists all
options that you accept in switch.

[1] http://plan9.bell-labs.com/magic/man2html/8/getflags
[2] http://plan9.bell-labs.com/magic/man2html/2/arg


Reply via email to