Source-Changes-D archive

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

Re: CVS commit: src/bin/echo



On Wed, May 15, 2024 at 05:22:25 +0700, Robert Elz wrote:

>   | Unfortunately that advice is not true without further caveats.
> 
> That you have to actually write a valid printf(1) command, and not
> simply s/echo/printf/ ?   Does that really need saying?
> 
> 
>   | netbsd$ sh -c "printf '-V\n'"
> 
> 	printf -- -V\\n 
> 
> and it will work anywhere - our printf is specially hacked as once
> upon a time it took no options, and this kind of thing would work.
> Format strings starting with a '-' don't work in general however,
> the '--' should be included if the format might begin with a '-'.
> 
> Even better would be
> 
> 	printf -- %s\\n -V
> 
> (where the -- is optional here).

I vaguely remember I read somewhere that printf(1) was specifically
conceived to take no options, but that can be planted memories.  May
be it's indeed induced by the old state of affairs in our version.


-uwe


Home | Main Index | Thread Index | Old Index