aboutsummaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-08-03 15:41:12 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-08-03 15:41:12 +0000
commit5e2a5391f9142bca773aab4c829615895b69a6b7 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /findutils
parente883e03918a0e26e390ea23996abdb8fc1925f88 (diff)
downloadbusybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.tar.gz
busybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.tar.bz2
busybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.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.) git-svn-id: svn://busybox.net/trunk/busybox@15767 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'findutils')
-rw-r--r--findutils/find.c17
-rw-r--r--findutils/grep.c9
-rw-r--r--findutils/xargs.c11
3 files changed, 8 insertions, 29 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
diff --git a/findutils/grep.c b/findutils/grep.c
index ecb1d0457..b53bf490a 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -17,11 +17,6 @@
17*/ 17*/
18 18
19#include "busybox.h" 19#include "busybox.h"
20#include <stdio.h>
21#include <stdlib.h>
22#include <getopt.h>
23#include <string.h>
24#include <errno.h>
25#include "xregex.h" 20#include "xregex.h"
26 21
27 22
@@ -203,7 +198,7 @@ static int grep_file(FILE *file)
203 /* Add the line to the circular 'before' buffer */ 198 /* Add the line to the circular 'before' buffer */
204 if(lines_before) { 199 if(lines_before) {
205 free(before_buf[curpos]); 200 free(before_buf[curpos]);
206 before_buf[curpos] = bb_xstrdup(line); 201 before_buf[curpos] = xstrdup(line);
207 curpos = (curpos + 1) % lines_before; 202 curpos = (curpos + 1) % lines_before;
208 } 203 }
209 } 204 }
@@ -271,7 +266,7 @@ static void load_regexes_from_file(llist_t *fopt)
271 266
272 fopt = cur->link; 267 fopt = cur->link;
273 free(cur); 268 free(cur);
274 f = bb_xfopen(ffile, "r"); 269 f = xfopen(ffile, "r");
275 while ((line = bb_get_chomped_line_from_file(f)) != NULL) { 270 while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
276 llist_add_to(&pattern_head, 271 llist_add_to(&pattern_head,
277 new_grep_list_data(line, PATTERN_MEM_A)); 272 new_grep_list_data(line, PATTERN_MEM_A));
diff --git a/findutils/xargs.c b/findutils/xargs.c
index c3a892695..e46708303 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -18,15 +18,6 @@
18 */ 18 */
19 19
20#include "busybox.h" 20#include "busybox.h"
21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h>
24#include <unistd.h>
25#include <getopt.h>
26#include <errno.h>
27#include <fcntl.h>
28#include <sys/types.h>
29#include <sys/wait.h>
30 21
31/* COMPAT: SYSV version defaults size (and has a max value of) to 470. 22/* COMPAT: SYSV version defaults size (and has a max value of) to 470.
32 We try to make it as large as possible. */ 23 We try to make it as large as possible. */
@@ -300,7 +291,7 @@ static int xargs_ask_confirmation(void)
300 int c, savec; 291 int c, savec;
301 292
302 if (!tty_stream) { 293 if (!tty_stream) {
303 tty_stream = bb_xfopen(CURRENT_TTY, "r"); 294 tty_stream = xfopen(CURRENT_TTY, "r");
304 /* pranoidal security by vodz */ 295 /* pranoidal security by vodz */
305 fcntl(fileno(tty_stream), F_SETFD, FD_CLOEXEC); 296 fcntl(fileno(tty_stream), F_SETFD, FD_CLOEXEC);
306 } 297 }