Package: libpopt
Version: 1.16-1

 

   The poptBadOption() function's return is confusing if the user supplies 
amalgamated multiple short options, only some of which are "bad".  The problem 
does not occur with isolated bad short options nor with bad long options.

 

   To use the popt man pages example, the short options b, c, h, n, r, s, and ? 
are possible, but if the user runs for instance 'parse -chnrsaw' (where 'a' and 
'w' are bad short options), the error message 'parse' spits out is "-chnrsaw: 
unknown option" because poptBadOption() returns "-chnrsaw" (and poptStrerror() 
returns "unknown option" for the poptGetNextOpt() error code).

 

   poptBadOption() should return, in the case of a bad short option, a single 
'-' followed by the bad short option only, omitting any short options before or 
after the culprit.  This is the expectation created by the comment in popt.h, 
which reads "Return the option which caused the most recent error. [...] 
@return offending option" (note the singular).

 

   With this simple correction, 'parse -chnrsaw' would now report "-a: unknown 
option", a perfectly acceptable message.  Note that 'parse -c -h -n -r -s -a 
-w' already results in this very message.

 

Daniel U. Thibault
R & D pour la défense Canada - Valcartier (RDDC Valcartier) / Defence R&D 
Canada - Valcartier (DRDC Valcartier)
Système de systèmes (SdS) / System of Systems (SoS)
Solutions informatiques et expérimentations (SIE) / Computing Solutions and 
Experimentations (CSE)
2459 Boul. Pie XI Nord
Québec, QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC:  <http://www.travelgis.com/map.asp?addr=918V%20QSDJ> 918V QSDJ
Gouvernement du Canada / Government of Canada
< <http://www.valcartier.drdc-rddc.gc.ca/> 
http://www.valcartier.drdc-rddc.gc.ca/>

Reply via email to