From owner-svn-src-head@FreeBSD.ORG Thu Sep 16 11:36:47 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 228AE1065670; Thu, 16 Sep 2010 11:36:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id AAA058FC1C; Thu, 16 Sep 2010 11:36:46 +0000 (UTC) Received: from c122-107-116-249.carlnfd1.nsw.optusnet.com.au (c122-107-116-249.carlnfd1.nsw.optusnet.com.au [122.107.116.249]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o8GBahV3020358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Sep 2010 21:36:44 +1000 Date: Thu, 16 Sep 2010 21:36:43 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: "David O'Brien" In-Reply-To: <20100916084442.GB21622@dragon.NUXI.org> Message-ID: <20100916212043.N724@delplex.bde.org> References: <201009091927.o89JReXm022426@svn.freebsd.org> <20100916084442.GB21622@dragon.NUXI.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1360494272-1284637003=:724" Cc: Juli Mallett , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212374 - head/usr.bin/printf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2010 11:36:47 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1360494272-1284637003=:724 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 16 Sep 2010, David O'Brien wrote: > On Thu, Sep 09, 2010 at 12:51:11PM -0700, Juli Mallett wrote: >> On Thu, Sep 9, 2010 at 12:27, David E. O'Brien wrot= e: >>> Author: obrien >>> Date: Thu Sep =A09 19:27:40 2010 >>> New Revision: 212374 >>> URL: http://svn.freebsd.org/changeset/base/212374 >>> >>> Log: >>> =A0Note bug in trying to printf(1) things like: '-%s\n' "foo" >> >> Should we also add something like this note to every manual page for a >> program that operates on files as command line arguments after options >> w.r.t. operating on files whose names begin with '-'? > > No. Because most programs have a synopsis like: > > ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1] [-D format] [file ...] > > However, printf(1)'s is > > printf format [arguments ...] > > Which does not say it takes ANY command-line options. Thus why should > one expect to have to trick out any command-line arguments "--" as one > would with 'grep -- --i *.c'? > > Is a sentence or two a burden to the man page vs. saving someone the time > I spent trying to figure out why printf(1) kept throwing up errors? WHat about the lesser burder on a character or two for putting -- in the synopsis where it is more visible: =09printf [--] format [arguments ...] POSIX doesn't do this, and it doesn't seem to say anything about the problem of a leading - in the format either. Presumably its general utilities specs require _all_ utilities to support "--". I wonder if there are any utilities that don't use getopt(3) and as a result aren't POSIX conformant since they don't support "--" and also need to support a first argument starting with "-" (which won't cause problems because getopt() is not there to mess it up, but the POSIX-specified way of a "--" before the arg won't work. sleep(1) was such a utility until recently -- FreeBSD hacked on it to remove its getopt(3) call, but didn't remove its man page's claim of "is expected to be (1003.2) POSIX compatible". 1003.2 is almost 20 years old now, so someone should know if sleep(1) was actually compatible with it. Bruce --0-1360494272-1284637003=:724--