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.)
This commit is contained in:
@@ -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
|
||||
|
@@ -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));
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user