tech-userlevel archive

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

/usr/bin/printf(1) not POSIX.2 compliant



Hello,

If I'm not mistaken, /usr/bin/printf(1) is not POSIX.2 compliant:

$ /usr/bin/printf "---\n"
printf: unknown option -- -
Usage: printf format [arg ...]

The specification says that printf has no options and we invoke
getopt(3). Every first argument, even looking like options, is a valid
format.

To circumvent:
$ /usr/bin/printf "\055--\n"
or
$ /usr/bin/printf "%c--\n" -

Solution:
	remove the call to getopt.

Am I correct? Is it worth a PR?

Best,
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index