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

Re: [libvirt] [PATCH 1/3] virt-xml-validate: add --help/--version option



On 08/19/2013 07:51 PM, Guan Nan Ren wrote:
>> This treats '-' as an unrecognized option (which is a bit misleading,
>> since in POSIX terminology a lone - is NOT an option but an argument).
>> It also raises the question - should we allow for an XMLFILE of '-' to
>> mean reading from stdin, the way POSIX recommends?  That is, should we
>> support:
>> 
>> virsh dumpxml $dom | virt-xml-validate -
> 
> 
> grep use "grep -f -" to donate the standard input. As written in its manpage
>  -f is specified by POSIX. If we use -f, the single hyphen can be used
> as a filename. But as you said in the follow, user can prefix the filename
> with a path - ./-, or /home/Tim/-, so it is still fine in this case.

Actually, 'grep -f - file' and 'grep pattern -' are two quite different
uses of '-' meaning stdin (one treats stdin as the file containing the
pattern, the other treats stdin as the file to search).  But yes, the
point is that since POSIX requires '-' to mean stdin when possible,
people are used to that idiom, and used to using ./- when wanting to
refer to a file literally named -.

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

Attachment: signature.asc
Description: OpenPGP digital signature


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