summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-10-05 21:59:30 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-10-05 21:59:30 +0000
commit480a37fe483b3e228a1ccd8f1fc1a60182fe5c4d (patch)
tree73d0dd296ac565ad9b6d4fec3dc2a4174329f9b8 /share
parent36eed06dd9be4b7d8dbb9e2b35ba1039917dfbab (diff)
change a few examples to be more stylistic. pointed out by rob pierce
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/style.917
1 files changed, 8 insertions, 9 deletions
diff --git a/share/man/man9/style.9 b/share/man/man9/style.9
index f34a56144e4..809c16f0594 100644
--- a/share/man/man9/style.9
+++ b/share/man/man9/style.9
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: style.9,v 1.62 2015/10/05 01:22:34 deraadt Exp $
+.\" $OpenBSD: style.9,v 1.63 2015/10/05 21:59:29 tedu Exp $
.\"
.Dd $Mdocdate: October 5 2015 $
.Dt STYLE 9
@@ -264,7 +264,7 @@ parts of the switch cascade.
Elements in a switch statement that cascade should have a FALLTHROUGH comment.
Numerical arguments should be checked for accuracy.
.Bd -literal -offset indent
-while ((ch = getopt(argc, argv, "abn:")) != -1)
+while ((ch = getopt(argc, argv, "abn:")) != -1) {
switch (ch) { /* Indent the switch. */
case 'a': /* Don't indent the case. */
aflag = 1;
@@ -282,6 +282,7 @@ while ((ch = getopt(argc, argv, "abn:")) != -1)
default:
usage();
}
+}
argc -= optind;
argv += optind;
.Ed
@@ -377,11 +378,11 @@ k = !(l & FLAGS);
.Pp
Exits should be 0 on success, or non-zero for errors.
.Bd -literal -offset indent
-exit(0); /*
- * Avoid obvious comments such as
- * "Exit 0 on success."
- */
-}
+/*
+ * Avoid obvious comments such as
+ * "Exit 0 on success."
+ */
+exit(0);
.Ed
.Pp
The function type should be on a line by itself
@@ -531,7 +532,6 @@ if ((four = malloc(sizeof(struct foo))) == NULL)
if ((six = (int *)overflow()) == NULL)
errx(1, "Number overflowed.");
return (eight);
-}
.Ed
.Pp
Old-style function declarations look like this:
@@ -602,7 +602,6 @@ string may be used instead of hard-coding the program name.
.Bd -literal -offset indent
(void)fprintf(stderr, "usage: %s [-ab]\en", __progname);
exit(1);
-}
.Ed
.Pp
New core kernel code should be reasonably compliant with the style guides.