aboutsummaryrefslogtreecommitdiff
path: root/findutils/find.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-03-29 13:54:17 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-03-29 13:54:17 +0000
commit32773aca55a25b6102b0169a6c160ad52831181a (patch)
treee8ec58ab144f2c60a359bbe304ea9fff45a8bb11 /findutils/find.c
parent3e816c1252cc55e3763f946622129d31ea1f0f20 (diff)
downloadbusybox-w32-32773aca55a25b6102b0169a6c160ad52831181a.tar.gz
busybox-w32-32773aca55a25b6102b0169a6c160ad52831181a.tar.bz2
busybox-w32-32773aca55a25b6102b0169a6c160ad52831181a.zip
- Purely cosmetic type fiddling
Diffstat (limited to 'findutils/find.c')
-rw-r--r--findutils/find.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/findutils/find.c b/findutils/find.c
index c043fbc7d..e7a514cca 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -56,7 +56,7 @@ typedef int (*action_fp)(const char *fileName, struct stat *statbuf, void *);
56typedef struct { 56typedef struct {
57 action_fp f; 57 action_fp f;
58#if ENABLE_FEATURE_FIND_NOT 58#if ENABLE_FEATURE_FIND_NOT
59 smallint invert; 59 bool invert;
60#endif 60#endif
61} action; 61} action;
62#define ACTS(name, arg...) typedef struct { action a; arg; } action_##name; 62#define ACTS(name, arg...) typedef struct { action a; arg; } action_##name;
@@ -77,7 +77,7 @@ USE_DESKTOP( ACTS(size, off_t size;))
77USE_DESKTOP( ACTS(prune)) 77USE_DESKTOP( ACTS(prune))
78 78
79static action ***actions; 79static action ***actions;
80static smalluint need_print = 1; 80static bool need_print = 1;
81 81
82 82
83#if ENABLE_FEATURE_FIND_EXEC 83#if ENABLE_FEATURE_FIND_EXEC
@@ -95,7 +95,7 @@ static unsigned int count_subst(const char *str)
95static char* subst(const char *src, unsigned int count, const char* filename) 95static char* subst(const char *src, unsigned int count, const char* filename)
96{ 96{
97 char *buf, *dst, *end; 97 char *buf, *dst, *end;
98 int flen = strlen(filename); 98 size_t flen = strlen(filename);
99 /* we replace each '{}' with filename: growth by strlen-2 */ 99 /* we replace each '{}' with filename: growth by strlen-2 */
100 buf = dst = xmalloc(strlen(src) + count*(flen-2) + 1); 100 buf = dst = xmalloc(strlen(src) + count*(flen-2) + 1);
101 while ((end = strstr(src, "{}"))) { 101 while ((end = strstr(src, "{}"))) {
@@ -271,23 +271,22 @@ ACTF(size)
271 271
272static int fileAction(const char *fileName, struct stat *statbuf, void* junk, int depth) 272static int fileAction(const char *fileName, struct stat *statbuf, void* junk, int depth)
273{ 273{
274 int rc; 274 int i;
275#ifdef CONFIG_FEATURE_FIND_XDEV 275#ifdef CONFIG_FEATURE_FIND_XDEV
276 if (S_ISDIR(statbuf->st_mode) && xdev_count) { 276 if (S_ISDIR(statbuf->st_mode) && xdev_count) {
277 int i;
278 for (i = 0; i < xdev_count; i++) { 277 for (i = 0; i < xdev_count; i++) {
279 if (xdev_dev[i] != statbuf->st_dev) 278 if (xdev_dev[i] != statbuf->st_dev)
280 return SKIP; 279 return SKIP;
281 } 280 }
282 } 281 }
283#endif 282#endif
284 rc = exec_actions(actions, fileName, statbuf); 283 i = exec_actions(actions, fileName, statbuf);
285 /* Had no explicit -print[0] or -exec? then print */ 284 /* Had no explicit -print[0] or -exec? then print */
286 if (rc && need_print) 285 if (i && need_print)
287 puts(fileName); 286 puts(fileName);
288 /* Cannot return 0: our caller, recursive_action(), 287 /* Cannot return 0: our caller, recursive_action(),
289 * will perror() and skip dirs (if called on dir) */ 288 * will perror() and skip dirs (if called on dir) */
290 return rc == 0 ? TRUE : rc; 289 return i == 0 ? TRUE : i;
291} 290}
292 291
293 292
@@ -342,7 +341,7 @@ static action*** parse_params(char **argv)
342 action*** appp; 341 action*** appp;
343 unsigned cur_group = 0; 342 unsigned cur_group = 0;
344 unsigned cur_action = 0; 343 unsigned cur_action = 0;
345 USE_FEATURE_FIND_NOT( smallint invert_flag = 0; ) 344 USE_FEATURE_FIND_NOT( bool invert_flag = 0; )
346 345
347 action* alloc_action(int sizeof_struct, action_fp f) 346 action* alloc_action(int sizeof_struct, action_fp f)
348 { 347 {
@@ -501,7 +500,7 @@ static action*** parse_params(char **argv)
501 ap->exec_argv = ++argv; /* first arg after -exec */ 500 ap->exec_argv = ++argv; /* first arg after -exec */
502 ap->exec_argc = 0; 501 ap->exec_argc = 0;
503 while (1) { 502 while (1) {
504 if (!*argv) /* did not see ';' till end */ 503 if (!*argv) /* did not see ';' util end */
505 bb_error_msg_and_die(bb_msg_requires_arg, arg); 504 bb_error_msg_and_die(bb_msg_requires_arg, arg);
506 if (LONE_CHAR(argv[0], ';')) 505 if (LONE_CHAR(argv[0], ';'))
507 break; 506 break;
@@ -595,11 +594,11 @@ int find_main(int argc, char **argv)
595 firstopt++; 594 firstopt++;
596 } 595 }
597 596
598// All options always return true. They always take effect, 597/* All options always return true. They always take effect
599// rather than being processed only when their place in the 598 * rather than being processed only when their place in the
600// expression is reached 599 * expression is reached.
601// We implement: -follow, -xdev 600 * We implement: -follow, -xdev
602 601 */
603 /* Process options, and replace then with -a */ 602 /* Process options, and replace then with -a */
604 /* (-a will be ignored by recursive parser later) */ 603 /* (-a will be ignored by recursive parser later) */
605 argp = &argv[firstopt]; 604 argp = &argv[firstopt];