diff options
author | will <will@FreeBSD.org> | 2001-01-21 08:37:35 +0000 |
---|---|---|
committer | will <will@FreeBSD.org> | 2001-01-21 08:37:35 +0000 |
commit | 7e6a9379747e18efa22fdb285658e4641d2718cf (patch) | |
tree | a360b21fafbae20d72fc8fcb97fa7f7ddff278b4 /usr.bin/apply | |
parent | 9e75a55e4ba3ce9b7eec70c9fa00d439225321c5 (diff) | |
download | FreeBSD-src-7e6a9379747e18efa22fdb285658e4641d2718cf.zip FreeBSD-src-7e6a9379747e18efa22fdb285658e4641d2718cf.tar.gz |
Fix numerous style(9) bugs: Put #define's before declarations; sort the
declarations & their arguments; use only one tab after types; restore the
type of argv to sync with src tree style; sort new variables under main();
fix continuation indents; remove extra blank line before free()'s. Still
to do: fix snprintf() handling as nectar & bde suggested to me.
Submitted by: bde
Diffstat (limited to 'usr.bin/apply')
-rw-r--r-- | usr.bin/apply/apply.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/usr.bin/apply/apply.c b/usr.bin/apply/apply.c index 70f3bdf..2224e49 100644 --- a/usr.bin/apply/apply.c +++ b/usr.bin/apply/apply.c @@ -55,16 +55,16 @@ static const char rcsid[] = #include <string.h> #include <unistd.h> -void usage(void); -static int exec_shell(char *, char *, const char *); +#define EXEC "exec " -#define EXEC "exec " +static int exec_shell(const char *, char *, char *); +static void usage(void); int -main(int argc, char **argv) { - int ch, debug, i, magic, n, nargs, rval, offset; - size_t clen, l, cmdsize; - char *c, *cmd, *p, *q, *shell, *name, *tmpshell, *slashp; +main(int argc, char *argv[]) { + int ch, debug, i, magic, n, nargs, offset, rval; + size_t clen, cmdsize, l; + char *c, *cmd, *name, *p, *q, *shell, *slashp, *tmpshell; debug = 0; magic = '%'; /* Default magic char is `%'. */ @@ -131,8 +131,8 @@ main(int argc, char **argv) { * Allocate enough space to hold the maximum command. Save the * size to pass to snprintf(). */ - cmdsize = sizeof(EXEC) - 1 + strlen(argv[0]) + 9 * - (sizeof(" %1") - 1) + 1; + cmdsize = sizeof(EXEC) - 1 + strlen(argv[0]) + + 9 * (sizeof(" %1") - 1) + 1; if ((cmd = malloc(cmdsize)) == NULL) err(1, NULL); @@ -207,14 +207,13 @@ main(int argc, char **argv) { if (debug) (void)printf("%s\n", c); else - if (exec_shell(shell, name, c)) + if (exec_shell(c, shell, name)) rval = 1; } if (argc != 1) errx(1, "expecting additional argument%s after \"%s\"", (nargs - argc) ? "s" : "", argv[argc - 1]); - free(cmd); free(c); free(shell); @@ -227,7 +226,7 @@ main(int argc, char **argv) { * arguments. */ static int -exec_shell(char *use_shell, char *use_name, const char *command) +exec_shell(const char *command, char *use_shell, char *use_name) { pid_t pid; int omask, pstat; |