diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-01-30 13:51:50 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-01-30 13:51:50 +0000 |
commit | 59c4e5cf9287321dfbf4d4400c69a53c907c5fb1 (patch) | |
tree | 7c3ad0994295513c1b60af05ab07a7228be5bca5 /findutils/xargs.c | |
parent | 676b15e06784eb35255e551e8925d0deca052345 (diff) | |
download | busybox-w32-59c4e5cf9287321dfbf4d4400c69a53c907c5fb1.tar.gz busybox-w32-59c4e5cf9287321dfbf4d4400c69a53c907c5fb1.tar.bz2 busybox-w32-59c4e5cf9287321dfbf4d4400c69a53c907c5fb1.zip |
removed warning "comparison between signed and unsigned". Added ATTRIBUTE_UNUSED. My whitespace
Diffstat (limited to 'findutils/xargs.c')
-rw-r--r-- | findutils/xargs.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c index eef7c6909..5a5e1c64c 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -71,13 +71,13 @@ | |||
71 | static int xargs_exec(char *const *args) | 71 | static int xargs_exec(char *const *args) |
72 | { | 72 | { |
73 | pid_t p; | 73 | pid_t p; |
74 | volatile int exec_errno = 0; /* shared vfork stack */ | 74 | volatile int exec_errno = 0; /* shared vfork stack */ |
75 | 75 | ||
76 | if ((p = vfork()) >= 0) { | 76 | if ((p = vfork()) >= 0) { |
77 | if (p == 0) { | 77 | if (p == 0) { |
78 | /* vfork -- child */ | 78 | /* vfork -- child */ |
79 | execvp(args[0], args); | 79 | execvp(args[0], args); |
80 | exec_errno = errno; /* set error to shared stack */ | 80 | exec_errno = errno; /* set error to shared stack */ |
81 | _exit(1); | 81 | _exit(1); |
82 | } else { | 82 | } else { |
83 | /* vfork -- parent */ | 83 | /* vfork -- parent */ |
@@ -137,18 +137,18 @@ static xlist_t *process_stdin(xlist_t * list_arg, | |||
137 | #define BACKSLASH 2 | 137 | #define BACKSLASH 2 |
138 | #define SPACE 4 | 138 | #define SPACE 4 |
139 | 139 | ||
140 | char *s = NULL; /* start word */ | 140 | char *s = NULL; /* start word */ |
141 | char *p = NULL; /* pointer to end word */ | 141 | char *p = NULL; /* pointer to end word */ |
142 | char q = 0; /* quote char */ | 142 | char q = 0; /* quote char */ |
143 | char state = NORM; | 143 | char state = NORM; |
144 | char eof_str_detected = 0; | 144 | char eof_str_detected = 0; |
145 | size_t line_l = 0; /* size loaded args line */ | 145 | size_t line_l = 0; /* size loaded args line */ |
146 | int c; /* current char */ | 146 | int c; /* current char */ |
147 | xlist_t *cur; | 147 | xlist_t *cur; |
148 | xlist_t *prev; | 148 | xlist_t *prev; |
149 | 149 | ||
150 | for (prev = cur = list_arg; cur; cur = cur->link) { | 150 | for (prev = cur = list_arg; cur; cur = cur->link) { |
151 | line_l += cur->lenght; /* previous allocated */ | 151 | line_l += cur->lenght; /* previous allocated */ |
152 | if (prev != cur) | 152 | if (prev != cur) |
153 | prev = prev->link; | 153 | prev = prev->link; |
154 | } | 154 | } |
@@ -192,13 +192,13 @@ unexpected_eof: | |||
192 | state = QUOTE; | 192 | state = QUOTE; |
193 | } else { | 193 | } else { |
194 | set: | 194 | set: |
195 | if ((p - buf) >= mc) | 195 | if ((size_t)(p - buf) >= mc) |
196 | bb_error_msg_and_die("argument line too long"); | 196 | bb_error_msg_and_die("argument line too long"); |
197 | *p++ = c; | 197 | *p++ = c; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | } | 200 | } |
201 | if (state == SPACE) { /* word's delimiter or EOF detected */ | 201 | if (state == SPACE) { /* word's delimiter or EOF detected */ |
202 | if (q) { | 202 | if (q) { |
203 | bb_error_msg_and_die("unmatched %s quote", | 203 | bb_error_msg_and_die("unmatched %s quote", |
204 | q == '\'' ? "single" : "double"); | 204 | q == '\'' ? "single" : "double"); |
@@ -238,16 +238,16 @@ static xlist_t *process_stdin(xlist_t * list_arg, | |||
238 | const char *eof_str, size_t mc, char *buf) | 238 | const char *eof_str, size_t mc, char *buf) |
239 | { | 239 | { |
240 | 240 | ||
241 | int c; /* current char */ | 241 | int c; /* current char */ |
242 | int eof_str_detected = 0; | 242 | int eof_str_detected = 0; |
243 | char *s = NULL; /* start word */ | 243 | char *s = NULL; /* start word */ |
244 | char *p = NULL; /* pointer to end word */ | 244 | char *p = NULL; /* pointer to end word */ |
245 | size_t line_l = 0; /* size loaded args line */ | 245 | size_t line_l = 0; /* size loaded args line */ |
246 | xlist_t *cur; | 246 | xlist_t *cur; |
247 | xlist_t *prev; | 247 | xlist_t *prev; |
248 | 248 | ||
249 | for (prev = cur = list_arg; cur; cur = cur->link) { | 249 | for (prev = cur = list_arg; cur; cur = cur->link) { |
250 | line_l += cur->lenght; /* previous allocated */ | 250 | line_l += cur->lenght; /* previous allocated */ |
251 | if (prev != cur) | 251 | if (prev != cur) |
252 | prev = prev->link; | 252 | prev = prev->link; |
253 | } | 253 | } |
@@ -269,7 +269,7 @@ static xlist_t *process_stdin(xlist_t * list_arg, | |||
269 | if ((p - buf) >= mc) | 269 | if ((p - buf) >= mc) |
270 | bb_error_msg_and_die("argument line too long"); | 270 | bb_error_msg_and_die("argument line too long"); |
271 | *p++ = c == EOF ? 0 : c; | 271 | *p++ = c == EOF ? 0 : c; |
272 | if (c == EOF) { /* word's delimiter or EOF detected */ | 272 | if (c == EOF) { /* word's delimiter or EOF detected */ |
273 | /* word loaded */ | 273 | /* word loaded */ |
274 | if (eof_str) { | 274 | if (eof_str) { |
275 | eof_str_detected = strcmp(s, eof_str) == 0; | 275 | eof_str_detected = strcmp(s, eof_str) == 0; |
@@ -340,18 +340,18 @@ static int xargs_ask_confirmation(void) | |||
340 | #endif | 340 | #endif |
341 | 341 | ||
342 | #ifdef CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM | 342 | #ifdef CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM |
343 | static xlist_t *process0_stdin(xlist_t * list_arg, const char *eof_str, | 343 | static xlist_t *process0_stdin(xlist_t * list_arg, const char *eof_str ATTRIBUTE_UNUSED, |
344 | size_t mc, char *buf) | 344 | size_t mc, char *buf) |
345 | { | 345 | { |
346 | int c; /* current char */ | 346 | int c; /* current char */ |
347 | char *s = NULL; /* start word */ | 347 | char *s = NULL; /* start word */ |
348 | char *p = NULL; /* pointer to end word */ | 348 | char *p = NULL; /* pointer to end word */ |
349 | size_t line_l = 0; /* size loaded args line */ | 349 | size_t line_l = 0; /* size loaded args line */ |
350 | xlist_t *cur; | 350 | xlist_t *cur; |
351 | xlist_t *prev; | 351 | xlist_t *prev; |
352 | 352 | ||
353 | for (prev = cur = list_arg; cur; cur = cur->link) { | 353 | for (prev = cur = list_arg; cur; cur = cur->link) { |
354 | line_l += cur->lenght; /* previous allocated */ | 354 | line_l += cur->lenght; /* previous allocated */ |
355 | if (prev != cur) | 355 | if (prev != cur) |
356 | prev = prev->link; | 356 | prev = prev->link; |
357 | } | 357 | } |
@@ -366,10 +366,10 @@ static xlist_t *process0_stdin(xlist_t * list_arg, const char *eof_str, | |||
366 | } | 366 | } |
367 | if (s == NULL) | 367 | if (s == NULL) |
368 | s = p = buf; | 368 | s = p = buf; |
369 | if ((p - buf) >= mc) | 369 | if ((size_t)(p - buf) >= mc) |
370 | bb_error_msg_and_die("argument line too long"); | 370 | bb_error_msg_and_die("argument line too long"); |
371 | *p++ = c; | 371 | *p++ = c; |
372 | if (c == 0) { /* word's delimiter or EOF detected */ | 372 | if (c == 0) { /* word's delimiter or EOF detected */ |
373 | /* word loaded */ | 373 | /* word loaded */ |
374 | size_t lenght = (p - buf); | 374 | size_t lenght = (p - buf); |
375 | 375 | ||
@@ -395,9 +395,9 @@ static xlist_t *process0_stdin(xlist_t * list_arg, const char *eof_str, | |||
395 | } | 395 | } |
396 | 396 | ||
397 | # define READ_ARGS(l, e, nmc, mc) (*read_args)(l, e, nmc, mc) | 397 | # define READ_ARGS(l, e, nmc, mc) (*read_args)(l, e, nmc, mc) |
398 | # define OPT_INC_0 1 /* future use */ | 398 | # define OPT_INC_0 1 /* future use */ |
399 | #else | 399 | #else |
400 | # define OPT_INC_0 0 /* future use */ | 400 | # define OPT_INC_0 0 /* future use */ |
401 | # define READ_ARGS(l, e, nmc, mc) process_stdin(l, e, nmc, mc) | 401 | # define READ_ARGS(l, e, nmc, mc) process_stdin(l, e, nmc, mc) |
402 | #endif /* CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM */ | 402 | #endif /* CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM */ |
403 | 403 | ||
@@ -410,7 +410,7 @@ static xlist_t *process0_stdin(xlist_t * list_arg, const char *eof_str, | |||
410 | #ifdef CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION | 410 | #ifdef CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION |
411 | #define OPT_INTERACTIVE (1<<5) | 411 | #define OPT_INTERACTIVE (1<<5) |
412 | #else | 412 | #else |
413 | #define OPT_INTERACTIVE (0) /* require for algorithm &| */ | 413 | #define OPT_INTERACTIVE (0) /* require for algorithm &| */ |
414 | #endif | 414 | #endif |
415 | #define OPT_TERMINATE (1<<(5+OPT_INC_P)) | 415 | #define OPT_TERMINATE (1<<(5+OPT_INC_P)) |
416 | #define OPT_ZEROTERM (1<<(5+OPT_INC_P+OPT_INC_X)) | 416 | #define OPT_ZEROTERM (1<<(5+OPT_INC_P+OPT_INC_X)) |
@@ -464,7 +464,7 @@ int xargs_main(int argc, char **argv) | |||
464 | orig_arg_max = ARG_MAX; | 464 | orig_arg_max = ARG_MAX; |
465 | if (orig_arg_max == -1) | 465 | if (orig_arg_max == -1) |
466 | orig_arg_max = LONG_MAX; | 466 | orig_arg_max = LONG_MAX; |
467 | orig_arg_max -= 2048; /* POSIX.2 requires subtracting 2048. */ | 467 | orig_arg_max -= 2048; /* POSIX.2 requires subtracting 2048. */ |
468 | if ((opt & OPT_UPTO_SIZE)) { | 468 | if ((opt & OPT_UPTO_SIZE)) { |
469 | n_max_chars = bb_xgetularg10_bnd(max_chars, 1, orig_arg_max); | 469 | n_max_chars = bb_xgetularg10_bnd(max_chars, 1, orig_arg_max); |
470 | for (i = 0; i < a; i++) { | 470 | for (i = 0; i < a; i++) { |