svn commit: r212607 - head/sbin/geom/core

Bruce Evans brde at optusnet.com.au
Tue Sep 14 15:02:35 UTC 2010


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


More information about the svn-src-all mailing list