From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 18:18:41 2009 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 CCC37106566C; Fri, 26 Jun 2009 18:18:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 6687D8FC14; Fri, 26 Jun 2009 18:18:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-126-113.carlnfd1.nsw.optusnet.com.au (c122-107-126-113.carlnfd1.nsw.optusnet.com.au [122.107.126.113]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n5QIG273002341 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 27 Jun 2009 04:16:06 +1000 Date: Sat, 27 Jun 2009 04:16:03 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: d@delphij.net In-Reply-To: <4A43B727.7010204@delphij.net> Message-ID: <20090627033608.P35379@delplex.bde.org> References: <200906232316.n5NNG1iT094289@svn.freebsd.org> <20090625154007.H33864@delplex.bde.org> <4A43B727.7010204@delphij.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI , Bruce Evans Subject: Re: svn commit: r194789 - head/usr.bin/usbhidctl 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: Fri, 26 Jun 2009 18:18:42 -0000 On Thu, 25 Jun 2009, Xin LI wrote: > Bruce Evans wrote: >> On Tue, 23 Jun 2009, Xin LI wrote: >> >>> Log: >>> Use getprogname() instead of referencing __progname. >> >> Neither is permitted in FreeBSD in usage(). > > I didn't see references about this? If this is discouraged, perhaps we > should mention it in style(9) or somewhere. FreeBSD style(9) simply doesn't mention getprogname(), while NetBSD share/misc/style requires it in the example usage(). Actually, it is OK to use it in FreeBSD iff the system supports the same program having different names, like reboot/halt/etc. > It looks like that a lot of > programs are using (not necessarily from NetBSD), but also others. Do > we have some discussion in the past regarding this? Most are still from NetBSD, except for lots in tools/regression. Most other uses are still correct ones, for things like setproctitle() (and for not so correct things like fprintf() -- why not use warnx()?). This was discussed in FreeBSD mailing lists years ago, and IIRC no one disagreed with the existing practice of hard-coding the program name. It can be considered a feature that if you copy or rename "cp" to "foo", its usage message reminds you that it is still "cp". >>> Modified: >>> head/usr.bin/usbhidctl/usbhid.c >> >> This was obtained from NetBSD, which requires using getprogname() in >> usage(). > > This is purely coincidence... I didn't even looked at NetBSD code in > this case, otherwise I would have brought the TNF copyright changes, > etc. altogether. The __progname in usbhidctl was obtained from NetBSD. Without this, the usage() function would have been a normal one and you shouldn't have needed to fix it. NetBSD of course fixed it long ago (FreeBSD obtained the bug in 2000 and it was fixed in NetBSD in 2001). In my 2005 copy of NetBSD, all usage() messages in utilities seem to have been roto-tilled to use getprogname(). This gives 343 files matching getprogname in NetBSD 2005 (incomplete sources but I forget how incomplete). FreeBSD now has only 88 files matching. Bruce