From owner-freebsd-bugs@FreeBSD.ORG Tue Jan 10 01:23:14 2012 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 557DA1065675; Tue, 10 Jan 2012 01:23:14 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 0EC208FC12; Tue, 10 Jan 2012 01:23:13 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.5/8.14.5) with ESMTP id q0A0stSn035856; Mon, 9 Jan 2012 17:54:55 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.5/8.14.5/Submit) with ESMTP id q0A0stmr035853; Mon, 9 Jan 2012 17:54:55 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Mon, 9 Jan 2012 17:54:55 -0700 (MST) From: Warren Block To: Bruce Evans In-Reply-To: <20120109183017.T1220@besplex.bde.org> Message-ID: References: <201201082105.q08L5EXm038909@red.freebsd.org> <20120109183017.T1220@besplex.bde.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Mon, 09 Jan 2012 17:54:55 -0700 (MST) Cc: freebsd-bugs@freebsd.org, freebsd-gnats-submit@freebsd.org Subject: Re: bin/163934: [patch] usbconfig(8) sends help output to stderr instead of stdout X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 01:23:14 -0000 On Mon, 9 Jan 2012, Bruce Evans wrote: > On Sun, 8 Jan 2012, Warren Block wrote: > >>> Description: >> usbconfig(8)'s -h option prints output to stderr. This output is not due >> to an error, and is already 28 lines line. A typical terminal will not >> display it all, so the user has to redirect stderr to view it with less or >> other utilities. >>> How-To-Repeat: >> usbconfig -h | less (then try to scroll back) >>> Fix: >> Apply attached patch. >> >> Patch attached with submission follows: >> >> Index: usbconfig.c >> =================================================================== >> --- usbconfig.c (revision 229822) >> +++ usbconfig.c (working copy) >> @@ -265,7 +265,7 @@ >> static void >> usage(void) >> { >> - fprintf(stderr, "" >> + fprintf(stdout, "" >> "usbconfig - configure the USB subsystem" "\n" >> "usage: usbconfig -u -a -i >> [cmds...]" "\n" >> "usage: usbconfig -d [ugen]. -i >> [cmds...]" "\n" > > This breaks the normal use of usage() for usage errors. Yes. My fault, I hadn't thought of that, er, usage of usage(). If usage() output is caused by an error, it should go to stderr, to keep it "out of band" of stdout. The user can request usage() output with -h or --help or something equivalent, and that output should go to stdout because it's not an error and that data is what was requested. IMO, of course. usbconfig doesn't actually have a -h option, usage() output is just a default fall-through.