getopt

John Macdonald jmm at eci386.uucp
Tue Jun 20 01:34:26 AEST 1989


In article <13730 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
}In article <782 at crdgw1.crd.ge.com> davidsen at crdos1.UUCP (bill davidsen) writes:
}>I have a program which needs an option which may have either a default
}>value or a specific value. ie. "-c" or "-c4" would be typical. I would
}>like to use getopt to read the values.
}
}This doesn't fit the Official Arg Passing Style, so even if you use a hook a
}kludge into getopt(), it isn't guaranteed to always work.
}
} [...]
}
}"-#" is a not uncommon debugging option.  I think ";" is a better choice,
}since it does half of what ":" does%, and because I don't know of any code
}that uses "-;" as an option.
}
}Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
}________
}% This pun works only if you pronounce them as "semicolon" and "colon".

Surely it would be better (except for punning purposes) to use -? to indicate
an optional argument.  Getopt precludes having a useful ? option since the
return of ? indicates an error occurred.  The ? is also suggests that the
option is "conditionally present".



More information about the Comp.lang.c mailing list