The recent switch to the getopt-gnu module weakened getopt.m4 to no longer 
require optind=0 nor reject optreset=1 as ways to reset internal state.  
However, coreutils currently uses optind=0 (in at least env.c), even though I 
noticed that getopt.m4 and the gnulib unit tests are now careful to define 
OPTIND_MIN to 1 for BSD systems.  Is coreutils' usage pattern going to break on 
a new enough BSD where the native getopt is now selected (where we previously 
used to force GNU getopt because native getopt had optreset)?

Is it worth adding a new module getopt-reset and adding a function call 
getopt_reset() that portably resets getopt internal state (either by optind=0 
or optreset=1) when the native getopt implementation is in use and does not 
support optind=0?

-- 
Eric Blake




Reply via email to