Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Sep 2010 15:28:54 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        jmallett@FreeBSD.org
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, obrien@FreeBSD.org, brde@optusnet.com.au
Subject:   Re: svn commit: r212374 - head/usr.bin/printf
Message-ID:  <20100916.152854.856152966653228621.imp@bsdimp.com>
In-Reply-To: <AANLkTimJfeXdP_9caoqBg3WPxpbgLRutDzBw%2BXM6veo5@mail.gmail.com>
References:  <20100916084442.GB21622@dragon.NUXI.org> <20100916212043.N724@delplex.bde.org> <AANLkTimJfeXdP_9caoqBg3WPxpbgLRutDzBw%2BXM6veo5@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <AANLkTimJfeXdP_9caoqBg3WPxpbgLRutDzBw+XM6veo5@mail.gmail.c=
om>
            Juli Mallett <jmallett@FreeBSD.org> writes:
: On Thu, Sep 16, 2010 at 04:36, Bruce Evans <brde@optusnet.com.au> wro=
te:
: > WHat about the lesser burder on a character or two for putting -- i=
n the
: > synopsis where it is more visible:
: >
: > =A0 =A0 =A0 =A0printf [--] 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 checkin=
g
: for "--" could be sufficient.  Does POSIX require that it exit with a=
n
: 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 tha=
t
: synopsis) if it encounters a string beginning with '-' other than
: "--".

	if (getenv("POSIX_ME_HARDER") && arg[0] =3D=3D '-' && arg[1] !=3D '-')=

		errx(1, "Strict posix compliance says you lose.");

might be all that's needed.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100916.152854.856152966653228621.imp>