|
Message-ID: <20141211033103.GA8429@brightrain.aerifal.cx> Date: Wed, 10 Dec 2014 22:31:03 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: new getopt features committed I've just committed support for options after non-option arguments ("argv permutation" ala GNU getopt) in getopt_long only (same way it works on BSD -- plain getopt is always POSIX conforming but getopt_long has the new feature) and abbreviated long options. Hopefully this eliminates the need to patch libc (like Alpine is doing up til now) or individual apps (like some other dists are doing) with an alternate getopt implementation. A couple differences from GNU and BSD variants: - The code in musl now does not honor $POSIXLY_CORRECT. The only way to suppress argv permutation in getopt_long is with a leading '+' in the optstring. This may be changed depending on feedback. - The progression of optind is different, and IMO much less counter-intuitive, when options after non-option arguments are being processed. But the final argv[] order and final optind after getopt_long returns -1 should be the same. - No additional internal state is kept for non-option argument skipping. As a result, more passes over argv[] are needed in some cases, but it shouldn't make a practical performance difference. - Reporting of errors may be different; this is unintentional and should be fixed. In particular getopt_long does not print any messages for long option errors; only short options (handled by getopt internally) produce messages. Return values may be different too. If there are any regressions, let me know. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.