ARGV parsing -- The Recommended way

Henry Spencer henry at utzoo.uucp
Sat Jul 15 01:49:31 AEST 1989


In article <7292 at bunny.GTE.COM> hhg1 at GTE.COM (Hallett German) writes:
>    And use other functions like getopt.

Using getopt is the right way to do it, unless there are *compelling*
reasons to do otherwise (notably, backward compatibility with a program
that uses non-standard syntax).  It is an enormous win to have standard,
predictable syntax for options.  Getopt, for all its warts, accomplishes
that, without breaking the whole world (which is what attempts at syntax
reform end up doing, which is why they always fail).

The one wart of getopt is that it's a bit awkward to use "cold".  The
most effective way is to type in the example from the getopt manual page
*once* and use that as a template, modifying a copy of it rather than
trying to type it in from scratch each time.
-- 
$10 million equals 18 PM       |     Henry Spencer at U of Toronto Zoology
(Pentagon-Minutes). -Tom Neff  | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list