svn commit: r212374 - head/usr.bin/printf

M. Warner Losh imp at bsdimp.com
Thu Sep 16 21:42:03 UTC 2010


In message: <AANLkTimJfeXdP_9caoqBg3WPxpbgLRutDzBw+XM6veo5 at mail.gmail.com>
            Juli Mallett <jmallett at FreeBSD.org> writes:
: On Thu, Sep 16, 2010 at 04:36, Bruce Evans <brde at optusnet.com.au> wrote:
: > WHat about the lesser burder on a character or two for putting -- in the
: > synopsis where it is more visible:
: >
: >        printf [--] format [arguments ...]
: 
: Right, that's what I've been thinking about.  For that matter, does
: printf(1) need to use getopt(3) at all?  It seems like simply checking
: for "--" could be sufficient.  Does POSIX require that it exit with an
: error if it's given any options?  At the very least, it seems like it
: would be more productive to have printf(1) give unusually-helpful
: error messages (perhaps merely changing its usage output to match that
: synopsis) if it encounters a string beginning with '-' other than
: "--".

	if (getenv("POSIX_ME_HARDER") && arg[0] == '-' && arg[1] != '-')
		errx(1, "Strict posix compliance says you lose.");

might be all that's needed.

Warner


More information about the svn-src-head mailing list