Deleted Added
full compact
apply.c (71326) apply.c (71615)
1/*-
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Jan-Simon Pendry.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 25 unchanged lines hidden (view full) ---

34 * SUCH DAMAGE.
35 */
36
37#ifndef lint
38#if 0
39static const char sccsid[] = "@(#)apply.c 8.4 (Berkeley) 4/4/94";
40#endif
41static const char rcsid[] =
1/*-
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Jan-Simon Pendry.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 25 unchanged lines hidden (view full) ---

34 * SUCH DAMAGE.
35 */
36
37#ifndef lint
38#if 0
39static const char sccsid[] = "@(#)apply.c 8.4 (Berkeley) 4/4/94";
40#endif
41static const char rcsid[] =
42 "$FreeBSD: head/usr.bin/apply/apply.c 71326 2001-01-21 08:37:35Z will $";
42 "$FreeBSD: head/usr.bin/apply/apply.c 71615 2001-01-25 03:40:17Z will $";
43#endif /* not lint */
44
45#include <sys/types.h>
46
47#include <sys/wait.h>
48
49#include <ctype.h>
50#include <err.h>

--- 90 unchanged lines hidden (view full) ---

141 if (nargs == -1)
142 nargs = 1;
143
144 p = cmd;
145 offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
146 if ((size_t)offset >= cmdsize)
147 err(1, "snprintf() failed");
148 p += offset;
43#endif /* not lint */
44
45#include <sys/types.h>
46
47#include <sys/wait.h>
48
49#include <ctype.h>
50#include <err.h>

--- 90 unchanged lines hidden (view full) ---

141 if (nargs == -1)
142 nargs = 1;
143
144 p = cmd;
145 offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
146 if ((size_t)offset >= cmdsize)
147 err(1, "snprintf() failed");
148 p += offset;
149 cmdsize -= offset;
149 for (i = 1; i <= nargs; i++) {
150 offset = snprintf(p, cmdsize, " %c%d", magic, i);
151 if ((size_t)offset >= cmdsize)
152 err(1, "snprintf() failed");
153 p += offset;
150 for (i = 1; i <= nargs; i++) {
151 offset = snprintf(p, cmdsize, " %c%d", magic, i);
152 if ((size_t)offset >= cmdsize)
153 err(1, "snprintf() failed");
154 p += offset;
155 cmdsize -= offset;
154 }
155
156 /*
157 * If nargs set to the special value 0, eat a single
158 * argument for each command execution.
159 */
160 if (nargs == 0)
161 nargs = 1;

--- 30 unchanged lines hidden (view full) ---

192 /* Expand command argv references. */
193 for (p = cmd, q = c; *p != '\0'; ++p)
194 if (p[0] == magic && isdigit(p[1]) && p[1] != '0') {
195 offset = snprintf(q, l, "%s",
196 argv[(++p)[0] - '0']);
197 if ((size_t)offset >= l)
198 err(1, "snprintf() failed");
199 q += offset;
156 }
157
158 /*
159 * If nargs set to the special value 0, eat a single
160 * argument for each command execution.
161 */
162 if (nargs == 0)
163 nargs = 1;

--- 30 unchanged lines hidden (view full) ---

194 /* Expand command argv references. */
195 for (p = cmd, q = c; *p != '\0'; ++p)
196 if (p[0] == magic && isdigit(p[1]) && p[1] != '0') {
197 offset = snprintf(q, l, "%s",
198 argv[(++p)[0] - '0']);
199 if ((size_t)offset >= l)
200 err(1, "snprintf() failed");
201 q += offset;
202 l -= offset;
200 } else
201 *q++ = *p;
202
203 /* Terminate the command string. */
204 *q = '\0';
205
206 /* Run the command. */
207 if (debug)

--- 57 unchanged lines hidden ---
203 } else
204 *q++ = *p;
205
206 /* Terminate the command string. */
207 *q = '\0';
208
209 /* Run the command. */
210 if (debug)

--- 57 unchanged lines hidden ---