Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Sep 2010 01:02:31 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r212607 - head/sbin/geom/core
Message-ID:  <20100915003923.B907@delplex.bde.org>
In-Reply-To: <201009141119.o8EBJLKU080003@svn.freebsd.org>
References:  <201009141119.o8EBJLKU080003@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 14 Sep 2010, Pawel Jakub Dawidek wrote:

> Log:
>  Remove dot which shouldn't be here, as err(3) will attach error message
>  at the end of the string.

In KNF, error messages are neither capitalized or terminated by a dot,
partly because of this.

> Modified: head/sbin/geom/core/geom.c
> ==============================================================================
> --- head/sbin/geom/core/geom.c	Tue Sep 14 11:13:46 2010	(r212606)
> +++ head/sbin/geom/core/geom.c	Tue Sep 14 11:19:21 2010	(r212607)
> @@ -262,7 +262,7 @@ set_option(struct gctl_req *req, struct
> 	if (G_OPT_TYPE(opt) == G_TYPE_NUMBER ||
> 	    G_OPT_TYPE(opt) == G_TYPE_ASCNUM) {
> 		if (expand_number(val, &number) == -1) {
> -			err(EXIT_FAILURE, "Invalid value for '%c' argument.",
> +			err(EXIT_FAILURE, "Invalid value for '%c' argument",
> 			    opt->go_char);
> 		}
> 		if (G_OPT_TYPE(opt) == G_TYPE_NUMBER) {
>

This message is still capitalized.  Most other error messages in
sbin/geom have same bugs.  Dots too, though this fixes the last dot
for err().  For errx() and warnx(), you can supply the dot without
ensuring the punctuation/grammar error ".:", but this is still a style
bug since it is not KNF and it is silly for the shorter error messages
without an errno string to be capitalized while longer ones with an
errno cannot be since err() has a fixed format not including the dot.

For the capitalization, a capital letter after the prefix "<progname>: "
is just a style bug.  I think capitalization after ": " looks strange,
especially after starting with a lower case program name.  Then the
errno string messes up the formatting a bit by always being capitalized.

In bin/*/*.c 1 month ago, the KNF rule about not capitializing err(1,
"Foo") is followed in approx. 66 lines and broken in just 7 lines (1
in cp and 6 in pkill), partly because of tree sweeps to unbreak this.
In Lite2 it was followed in approx. 29 lines and broken in just 1 line
(in rmail).

Bruce



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