On 10/21/2015 08:03 AM, Bernhard Voelker wrote:

> 
> One approach would be to have another first-pass getopt_long()
> loop for searching --help only:
> 
>   $ src/chmod-OLD --reference --help
>   src/chmod-OLD: missing operand
>   Try 'src/chmod-OLD --help' for more information.
> 
>   $ src/chmod --reference --help | head -n3
>   src/chmod: unrecognized option '--reference'
>   Usage: src/chmod [OPTION]... MODE[,MODE]... FILE...

Eww.  I don't like that, because it is likely to misinterpret valid
command lines:

chmod --reference --help .

must be synonymous with:

chmod --reference ./--help .

and NOT print help output.  Any two-pass system MUST treat
long-option-requiring-argument the same in both passes.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to