aboutsummaryrefslogtreecommitdiff
path: root/findutils
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
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
downloadbusybox-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.gz
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')
-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 @@
*/
#include "busybox.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <string.h>
-#include <stdlib.h>
#include <fnmatch.h>
-#include <time.h>
-#include <ctype.h>
static char *pattern;
#ifdef CONFIG_FEATURE_FIND_PRINT0
@@ -138,8 +131,8 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
int i;
char *cmd_string = "";
for (i = 0; i < num_matches; i++)
- cmd_string = bb_xasprintf("%s%s%s", cmd_string, exec_str[i], fileName);
- cmd_string = bb_xasprintf("%s%s", cmd_string, exec_str[num_matches]);
+ cmd_string = xasprintf("%s%s%s", cmd_string, exec_str[i], fileName);
+ cmd_string = xasprintf("%s%s", cmd_string, exec_str[num_matches]);
system(cmd_string);
goto no_match;
}
@@ -300,7 +293,7 @@ int find_main(int argc, char **argv)
bb_error_msg_and_die(bb_msg_requires_arg, "-exec");
if (*argv[i] == ';')
break;
- cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]);
+ cmd_string = xasprintf("%s %s", cmd_string, argv[i]);
}
if (*cmd_string == 0)
@@ -311,10 +304,10 @@ int find_main(int argc, char **argv)
while ((b_pos = strstr(cmd_string, "{}") - cmd_string), (b_pos >= 0)) {
num_matches++;
exec_str = xrealloc(exec_str, (num_matches + 1) * sizeof(char *));
- exec_str[num_matches - 1] = bb_xstrndup(cmd_string, b_pos);
+ exec_str[num_matches - 1] = xstrndup(cmd_string, b_pos);
cmd_string += b_pos + 2;
}
- exec_str[num_matches] = bb_xstrdup(cmd_string);
+ exec_str[num_matches] = xstrdup(cmd_string);
exec_opt = 1;
#endif
} 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 @@
*/
#include "busybox.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include <errno.h>
#include "xregex.h"
@@ -203,7 +198,7 @@ static int grep_file(FILE *file)
/* Add the line to the circular 'before' buffer */
if(lines_before) {
free(before_buf[curpos]);
- before_buf[curpos] = bb_xstrdup(line);
+ before_buf[curpos] = xstrdup(line);
curpos = (curpos + 1) % lines_before;
}
}
@@ -271,7 +266,7 @@ static void load_regexes_from_file(llist_t *fopt)
fopt = cur->link;
free(cur);
- f = bb_xfopen(ffile, "r");
+ f = xfopen(ffile, "r");
while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
llist_add_to(&pattern_head,
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 @@
*/
#include "busybox.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/wait.h>
/* COMPAT: SYSV version defaults size (and has a max value of) to 470.
We try to make it as large as possible. */
@@ -300,7 +291,7 @@ static int xargs_ask_confirmation(void)
int c, savec;
if (!tty_stream) {
- tty_stream = bb_xfopen(CURRENT_TTY, "r");
+ tty_stream = xfopen(CURRENT_TTY, "r");
/* pranoidal security by vodz */
fcntl(fileno(tty_stream), F_SETFD, FD_CLOEXEC);
}