aboutsummaryrefslogtreecommitdiff
path: root/findutils/find.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
committerRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
commitd921b2ecc0d294ad4bf8c7458fc52a60c28727d2 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /findutils/find.c
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
downloadbusybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.gz
busybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.bz2
busybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.zip
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
Diffstat (limited to 'findutils/find.c')
-rw-r--r--findutils/find.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 1e15e8899..aa915fa0f 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -11,14 +11,7 @@
11 */ 11 */
12 12
13#include "busybox.h" 13#include "busybox.h"
14#include <stdio.h>
15#include <unistd.h>
16#include <dirent.h>
17#include <string.h>
18#include <stdlib.h>
19#include <fnmatch.h> 14#include <fnmatch.h>
20#include <time.h>
21#include <ctype.h>
22 15
23static char *pattern; 16static char *pattern;
24#ifdef CONFIG_FEATURE_FIND_PRINT0 17#ifdef CONFIG_FEATURE_FIND_PRINT0
@@ -138,8 +131,8 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
138 int i; 131 int i;
139 char *cmd_string = ""; 132 char *cmd_string = "";
140 for (i = 0; i < num_matches; i++) 133 for (i = 0; i < num_matches; i++)
141 cmd_string = bb_xasprintf("%s%s%s", cmd_string, exec_str[i], fileName); 134 cmd_string = xasprintf("%s%s%s", cmd_string, exec_str[i], fileName);
142 cmd_string = bb_xasprintf("%s%s", cmd_string, exec_str[num_matches]); 135 cmd_string = xasprintf("%s%s", cmd_string, exec_str[num_matches]);
143 system(cmd_string); 136 system(cmd_string);
144 goto no_match; 137 goto no_match;
145 } 138 }
@@ -300,7 +293,7 @@ int find_main(int argc, char **argv)
300 bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); 293 bb_error_msg_and_die(bb_msg_requires_arg, "-exec");
301 if (*argv[i] == ';') 294 if (*argv[i] == ';')
302 break; 295 break;
303 cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]); 296 cmd_string = xasprintf("%s %s", cmd_string, argv[i]);
304 } 297 }
305 298
306 if (*cmd_string == 0) 299 if (*cmd_string == 0)
@@ -311,10 +304,10 @@ int find_main(int argc, char **argv)
311 while ((b_pos = strstr(cmd_string, "{}") - cmd_string), (b_pos >= 0)) { 304 while ((b_pos = strstr(cmd_string, "{}") - cmd_string), (b_pos >= 0)) {
312 num_matches++; 305 num_matches++;
313 exec_str = xrealloc(exec_str, (num_matches + 1) * sizeof(char *)); 306 exec_str = xrealloc(exec_str, (num_matches + 1) * sizeof(char *));
314 exec_str[num_matches - 1] = bb_xstrndup(cmd_string, b_pos); 307 exec_str[num_matches - 1] = xstrndup(cmd_string, b_pos);
315 cmd_string += b_pos + 2; 308 cmd_string += b_pos + 2;
316 } 309 }
317 exec_str[num_matches] = bb_xstrdup(cmd_string); 310 exec_str[num_matches] = xstrdup(cmd_string);
318 exec_opt = 1; 311 exec_opt = 1;
319#endif 312#endif
320 } else 313 } else