Date: Tue, 14 Dec 2010 19:08:56 +0100 From: Jilles Tjoelker <jilles@stack.nl> To: Xin LI <delphij@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r216422 - head/usr.bin/printf Message-ID: <20101214180856.GA67294@stack.nl> In-Reply-To: <201012140021.oBE0LZI9097999@svn.freebsd.org> References: <201012140021.oBE0LZI9097999@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 14, 2010 at 12:21:35AM +0000, Xin LI wrote: > Author: delphij > Date: Tue Dec 14 00:21:34 2010 > New Revision: 216422 > URL: http://svn.freebsd.org/changeset/base/216422 > Log: > Make use of EX_USAGE for usage(). > Modified: > head/usr.bin/printf/printf.c > Modified: head/usr.bin/printf/printf.c > ============================================================================== > --- head/usr.bin/printf/printf.c Mon Dec 13 23:53:55 2010 (r216421) > +++ head/usr.bin/printf/printf.c Tue Dec 14 00:21:34 2010 (r216422) [...] > + exit(EX_USAGE); > } This does not work properly when printf is an sh builtin. The exit() call causes sh to exit entirely, rather than the builtin to return to the shell. The bug can be noticed easily because the test errors/option-error.0 (from tools/regression/bin/sh) fails. Please revert to returning the exit status from main(). Although I plan to clean up usr.bin/printf slightly after the n$ stuff is committed, I do not plan on adding things to sh that will allow exit() emulation in builtins. Other people have already said things about <sysexits.h>. -- Jilles Tjoelker
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101214180856.GA67294>