summaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
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 1e15e88..aa915fa 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 ecb1d04..b53bf49 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 c3a8926..e467083 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);
}