bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getopt-gnu vs. optind=0


From: Eric Blake
Subject: getopt-gnu vs. optind=0
Date: Fri, 23 Oct 2009 18:32:36 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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

[Prev in Thread] Current Thread [Next in Thread]