From: Chris Pressey Date: Tue, 4 Jan 2005 05:45:02 +0000 (+0000) Subject: Style(9) cleanup: X-Git-Tag: v2.0.1~9295 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/397030aee2233db15b0635f44ce1041636c5c697 Style(9) cleanup: - Add braces to multi-line blocks; - Remove casts to void when ignoring return values; - Explicitly compare a pointer against NULL; - Remove a blank line at the start of a function; - Raise WARNS to 6. Based-on-patch-submitted-by: Dion Blazakis --- diff --git a/usr.bin/apply/Makefile b/usr.bin/apply/Makefile index 381f6b6818..d623041355 100644 --- a/usr.bin/apply/Makefile +++ b/usr.bin/apply/Makefile @@ -1,9 +1,9 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD: src/usr.bin/apply/Makefile,v 1.2.6.1 2001/08/01 23:26:27 obrien Exp $ -# $DragonFly: src/usr.bin/apply/Makefile,v 1.2 2003/06/17 04:29:25 dillon Exp $ +# $DragonFly: src/usr.bin/apply/Makefile,v 1.3 2005/01/04 05:45:02 cpressey Exp $ PROG= apply -WARNS?= 2 +WARNS?= 6 .include diff --git a/usr.bin/apply/apply.c b/usr.bin/apply/apply.c index 77a2178a20..f980748cab 100644 --- a/usr.bin/apply/apply.c +++ b/usr.bin/apply/apply.c @@ -35,7 +35,7 @@ * * @(#)apply.c 8.4 (Berkeley) 4/4/94 * $FreeBSD: src/usr.bin/apply/apply.c,v 1.8.2.3 2001/08/01 23:28:04 obrien Exp $ - * $DragonFly: src/usr.bin/apply/apply.c,v 1.4 2004/06/19 12:34:52 hmp Exp $ + * $DragonFly: src/usr.bin/apply/apply.c,v 1.5 2005/01/04 05:45:02 cpressey Exp $ */ #include @@ -189,7 +189,7 @@ main(int argc, char *argv[]) err(1, NULL); /* Expand command argv references. */ - for (p = cmd, q = c; *p != '\0'; ++p) + for (p = cmd, q = c; *p != '\0'; ++p) { if (p[0] == magic && isdigit(p[1]) && p[1] != '0') { offset = snprintf(q, l, "%s", argv[(++p)[0] - '0']); @@ -197,18 +197,21 @@ main(int argc, char *argv[]) err(1, "snprintf() failed"); q += offset; l -= offset; - } else + } else { *q++ = *p; + } + } /* Terminate the command string. */ *q = '\0'; /* Run the command. */ - if (debug) - (void)printf("%s\n", c); - else + if (debug) { + printf("%s\n", c); + } else { if (exec_shell(c, shell, name)) rval = 1; + } } if (argc != 1) @@ -232,7 +235,7 @@ exec_shell(const char *command, char *use_shell, char *use_name) int omask, pstat; sig_t intsave, quitsave; - if (!command) /* just checking... */ + if (command == NULL) /* just checking... */ return(1); omask = sigblock(sigmask(SIGCHLD)); @@ -248,17 +251,17 @@ exec_shell(const char *command, char *use_shell, char *use_name) intsave = signal(SIGINT, SIG_IGN); quitsave = signal(SIGQUIT, SIG_IGN); pid = waitpid(pid, &pstat, 0); - (void)sigsetmask(omask); - (void)signal(SIGINT, intsave); - (void)signal(SIGQUIT, quitsave); + sigsetmask(omask); + signal(SIGINT, intsave); + signal(SIGQUIT, quitsave); return(pid == -1 ? -1 : pstat); } void usage(void) { - - (void)fprintf(stderr, - "usage: apply [-a magic] [-d] [-0123456789] command arguments ...\n"); + fprintf(stderr, + "usage: apply [-a magic] [-d] [-0123456789] " + "command arguments ...\n"); exit(1); }