getopt() argument permuting considered risky
Simon Josefsson
jas@extundo.com
Wed Aug 4 20:06:00 GMT 2004
Thought I could mention a story about the getopt argument permutation:
For my fork of GNU InetUtils I received a patch that would add "+" to
disable the permutation, because this command:
rsh sol tail -f /var/log/mail
Would get permuted into:
rsh -f sol tail /var/log/mail
And the getopt command line parser would try to interpret the '-f',
which would fail.
On the ranting side, I think it would have been better if this feature
had originally been introduced via a separate API, say getopt_gnu,
instead. That would have minimized surprises, both pleasant and
unpleasant ones.
More information about the Libc-alpha
mailing list