diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cal.c | 14 | ||||
-rw-r--r-- | coreutils/catv.c | 4 | ||||
-rw-r--r-- | coreutils/chroot.c | 6 | ||||
-rw-r--r-- | coreutils/cksum.c | 5 | ||||
-rw-r--r-- | coreutils/cmp.c | 11 | ||||
-rw-r--r-- | coreutils/comm.c | 6 | ||||
-rw-r--r-- | coreutils/dd.c | 12 | ||||
-rw-r--r-- | coreutils/diff.c | 41 | ||||
-rw-r--r-- | coreutils/dos2unix.c | 6 | ||||
-rw-r--r-- | coreutils/expr.c | 16 | ||||
-rw-r--r-- | coreutils/fold.c | 9 | ||||
-rw-r--r-- | coreutils/head.c | 7 | ||||
-rw-r--r-- | coreutils/ln.c | 10 | ||||
-rw-r--r-- | coreutils/ls.c | 12 | ||||
-rw-r--r-- | coreutils/md5_sha1_sum.c | 10 | ||||
-rw-r--r-- | coreutils/nohup.c | 7 | ||||
-rw-r--r-- | coreutils/sort.c | 14 | ||||
-rw-r--r-- | coreutils/stat.c | 14 | ||||
-rw-r--r-- | coreutils/stty.c | 36 | ||||
-rw-r--r-- | coreutils/tee.c | 6 | ||||
-rw-r--r-- | coreutils/uniq.c | 7 | ||||
-rw-r--r-- | coreutils/uudecode.c | 9 | ||||
-rw-r--r-- | coreutils/uuencode.c | 11 | ||||
-rw-r--r-- | coreutils/watch.c | 10 |
24 files changed, 53 insertions, 230 deletions
diff --git a/coreutils/cal.c b/coreutils/cal.c index 5d61b6ccf..9628459fe 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
@@ -17,20 +17,8 @@ | |||
17 | * Major size reduction... over 50% (>1.5k) on i386. | 17 | * Major size reduction... over 50% (>1.5k) on i386. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <sys/types.h> | ||
21 | #include <ctype.h> | ||
22 | #include <stdio.h> | ||
23 | #include <stdlib.h> | ||
24 | #include <string.h> | ||
25 | #include <time.h> | ||
26 | #include <unistd.h> | ||
27 | |||
28 | #include "busybox.h" | 20 | #include "busybox.h" |
29 | 21 | ||
30 | #ifdef CONFIG_LOCALE_SUPPORT | ||
31 | #include <locale.h> | ||
32 | #endif | ||
33 | |||
34 | #define THURSDAY 4 /* for reformation */ | 22 | #define THURSDAY 4 /* for reformation */ |
35 | #define SATURDAY 6 /* 1 Jan 1 was a Saturday */ | 23 | #define SATURDAY 6 /* 1 Jan 1 was a Saturday */ |
36 | 24 | ||
@@ -135,7 +123,7 @@ int cal_main(int argc, char **argv) | |||
135 | do { | 123 | do { |
136 | zero_tm.tm_mon = i; | 124 | zero_tm.tm_mon = i; |
137 | strftime(buf, sizeof(buf), "%B", &zero_tm); | 125 | strftime(buf, sizeof(buf), "%B", &zero_tm); |
138 | month_names[i] = bb_xstrdup(buf); | 126 | month_names[i] = xstrdup(buf); |
139 | 127 | ||
140 | if (i < 7) { | 128 | if (i < 7) { |
141 | zero_tm.tm_wday = i; | 129 | zero_tm.tm_wday = i; |
diff --git a/coreutils/catv.c b/coreutils/catv.c index dd4aa44e3..e18203915 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c | |||
@@ -11,8 +11,6 @@ | |||
11 | * http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */ | 11 | * http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */ |
12 | 12 | ||
13 | #include "busybox.h" | 13 | #include "busybox.h" |
14 | #include <unistd.h> | ||
15 | #include <fcntl.h> | ||
16 | 14 | ||
17 | int catv_main(int argc, char **argv) | 15 | int catv_main(int argc, char **argv) |
18 | { | 16 | { |
@@ -28,7 +26,7 @@ int catv_main(int argc, char **argv) | |||
28 | // Read from stdin if there's nothing else to do. | 26 | // Read from stdin if there's nothing else to do. |
29 | 27 | ||
30 | fd = 0; | 28 | fd = 0; |
31 | if (*argv && 0>(fd = bb_xopen(*argv, O_RDONLY))) retval = EXIT_FAILURE; | 29 | if (*argv && 0>(fd = xopen(*argv, O_RDONLY))) retval = EXIT_FAILURE; |
32 | else for(;;) { | 30 | else for(;;) { |
33 | int i, res; | 31 | int i, res; |
34 | 32 | ||
diff --git a/coreutils/chroot.c b/coreutils/chroot.c index 8ad680c02..62cfdc244 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c | |||
@@ -9,10 +9,6 @@ | |||
9 | 9 | ||
10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ | 10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ |
11 | 11 | ||
12 | #include <stdlib.h> | ||
13 | #include <stdio.h> | ||
14 | #include <unistd.h> | ||
15 | #include <errno.h> | ||
16 | #include "busybox.h" | 12 | #include "busybox.h" |
17 | 13 | ||
18 | int chroot_main(int argc, char **argv) | 14 | int chroot_main(int argc, char **argv) |
@@ -25,7 +21,7 @@ int chroot_main(int argc, char **argv) | |||
25 | if (chroot(*argv)) { | 21 | if (chroot(*argv)) { |
26 | bb_perror_msg_and_die("cannot change root directory to %s", *argv); | 22 | bb_perror_msg_and_die("cannot change root directory to %s", *argv); |
27 | } | 23 | } |
28 | bb_xchdir("/"); | 24 | xchdir("/"); |
29 | 25 | ||
30 | ++argv; | 26 | ++argv; |
31 | if (argc == 2) { | 27 | if (argc == 2) { |
diff --git a/coreutils/cksum.c b/coreutils/cksum.c index 1396a5d5b..5849ddab2 100644 --- a/coreutils/cksum.c +++ b/coreutils/cksum.c | |||
@@ -6,14 +6,11 @@ | |||
6 | * | 6 | * |
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ | 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ |
8 | 8 | ||
9 | #include <stdio.h> | ||
10 | #include <unistd.h> | ||
11 | #include <fcntl.h> | ||
12 | #include "busybox.h" | 9 | #include "busybox.h" |
13 | 10 | ||
14 | int cksum_main(int argc, char **argv) { | 11 | int cksum_main(int argc, char **argv) { |
15 | 12 | ||
16 | uint32_t *crc32_table = bb_crc32_filltable(1); | 13 | uint32_t *crc32_table = crc32_filltable(1); |
17 | 14 | ||
18 | FILE *fp; | 15 | FILE *fp; |
19 | uint32_t crc; | 16 | uint32_t crc; |
diff --git a/coreutils/cmp.c b/coreutils/cmp.c index 016158bfe..a569eb3fe 100644 --- a/coreutils/cmp.c +++ b/coreutils/cmp.c | |||
@@ -21,9 +21,6 @@ | |||
21 | * in the '-l' case. | 21 | * in the '-l' case. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <stdio.h> | ||
25 | #include <stdlib.h> | ||
26 | #include <unistd.h> | ||
27 | #include "busybox.h" | 24 | #include "busybox.h" |
28 | 25 | ||
29 | static FILE *cmp_xfopen_input(const char *filename) | 26 | static FILE *cmp_xfopen_input(const char *filename) |
@@ -105,12 +102,12 @@ int cmp_main(int argc, char **argv) | |||
105 | c1 = c2; | 102 | c1 = c2; |
106 | } | 103 | } |
107 | if (c1 == EOF) { | 104 | if (c1 == EOF) { |
108 | bb_xferror(fp1, filename1); | 105 | xferror(fp1, filename1); |
109 | fmt = fmt_eof; /* Well, no error, so it must really be EOF. */ | 106 | fmt = fmt_eof; /* Well, no error, so it must really be EOF. */ |
110 | outfile = stderr; | 107 | outfile = stderr; |
111 | /* There may have been output to stdout (option -l), so | 108 | /* There may have been output to stdout (option -l), so |
112 | * make sure we fflush before writing to stderr. */ | 109 | * make sure we fflush before writing to stderr. */ |
113 | bb_xfflush_stdout(); | 110 | xfflush_stdout(); |
114 | } | 111 | } |
115 | if (opt_flags != OPT_s) { | 112 | if (opt_flags != OPT_s) { |
116 | if (opt_flags == OPT_l) { | 113 | if (opt_flags == OPT_l) { |
@@ -129,8 +126,8 @@ int cmp_main(int argc, char **argv) | |||
129 | } | 126 | } |
130 | } while (c1 != EOF); | 127 | } while (c1 != EOF); |
131 | 128 | ||
132 | bb_xferror(fp1, filename1); | 129 | xferror(fp1, filename1); |
133 | bb_xferror(fp2, filename2); | 130 | xferror(fp2, filename2); |
134 | 131 | ||
135 | bb_fflush_stdout_and_exit(exit_val); | 132 | bb_fflush_stdout_and_exit(exit_val); |
136 | } | 133 | } |
diff --git a/coreutils/comm.c b/coreutils/comm.c index 8b9380175..7524a7b25 100644 --- a/coreutils/comm.c +++ b/coreutils/comm.c | |||
@@ -7,10 +7,6 @@ | |||
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <stdio.h> | ||
11 | #include <stdlib.h> | ||
12 | #include <string.h> | ||
13 | #include <unistd.h> | ||
14 | #include "busybox.h" | 10 | #include "busybox.h" |
15 | 11 | ||
16 | #define COMM_OPT_1 0x01 | 12 | #define COMM_OPT_1 0x01 |
@@ -57,7 +53,7 @@ static void cmp_files(char **infiles) | |||
57 | int i; | 53 | int i; |
58 | 54 | ||
59 | for (i = 0; i < 2; ++i) { | 55 | for (i = 0; i < 2; ++i) { |
60 | streams[i] = ((infiles[i][0] == '=' && infiles[i][1]) ? stdin : bb_xfopen(infiles[i], "r")); | 56 | streams[i] = ((infiles[i][0] == '=' && infiles[i][1]) ? stdin : xfopen(infiles[i], "r")); |
61 | fgets(thisline[i], LINE_LEN, streams[i]); | 57 | fgets(thisline[i], LINE_LEN, streams[i]); |
62 | } | 58 | } |
63 | 59 | ||
diff --git a/coreutils/dd.c b/coreutils/dd.c index 3d6f7cd2d..052cd2902 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -8,14 +8,6 @@ | |||
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <sys/types.h> | ||
12 | #include <sys/stat.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <stdio.h> | ||
15 | #include <unistd.h> | ||
16 | #include <string.h> | ||
17 | #include <fcntl.h> | ||
18 | #include <signal.h> // For FEATURE_DD_SIGNAL_HANDLING | ||
19 | #include "busybox.h" | 11 | #include "busybox.h" |
20 | 12 | ||
21 | static const struct suffix_mult dd_suffixes[] = { | 13 | static const struct suffix_mult dd_suffixes[] = { |
@@ -110,7 +102,7 @@ int dd_main(int argc, char **argv) | |||
110 | else obuf = ibuf; | 102 | else obuf = ibuf; |
111 | 103 | ||
112 | if (infile != NULL) { | 104 | if (infile != NULL) { |
113 | ifd = bb_xopen(infile, O_RDONLY); | 105 | ifd = xopen(infile, O_RDONLY); |
114 | } else { | 106 | } else { |
115 | ifd = STDIN_FILENO; | 107 | ifd = STDIN_FILENO; |
116 | infile = bb_msg_standard_input; | 108 | infile = bb_msg_standard_input; |
@@ -123,7 +115,7 @@ int dd_main(int argc, char **argv) | |||
123 | oflag |= O_TRUNC; | 115 | oflag |= O_TRUNC; |
124 | } | 116 | } |
125 | 117 | ||
126 | ofd = bb_xopen3(outfile, oflag, 0666); | 118 | ofd = xopen3(outfile, oflag, 0666); |
127 | 119 | ||
128 | if (seek && trunc_flag) { | 120 | if (seek && trunc_flag) { |
129 | if (ftruncate(ofd, seek * obs) < 0) { | 121 | if (ftruncate(ofd, seek * obs) < 0) { |
diff --git a/coreutils/diff.c b/coreutils/diff.c index 368efd383..22c157412 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c | |||
@@ -12,23 +12,6 @@ | |||
12 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 12 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <time.h> | ||
16 | #include <sys/types.h> | ||
17 | #include <sys/param.h> | ||
18 | #include <sys/stat.h> | ||
19 | #include <ctype.h> | ||
20 | #include <errno.h> | ||
21 | #include <signal.h> | ||
22 | #include <stdlib.h> | ||
23 | #include <stdio.h> | ||
24 | #include <stdarg.h> | ||
25 | #include <string.h> | ||
26 | #include <unistd.h> | ||
27 | #include <sys/wait.h> | ||
28 | #include <fcntl.h> | ||
29 | #include <stddef.h> | ||
30 | #include <paths.h> | ||
31 | #include <dirent.h> | ||
32 | #include "busybox.h" | 15 | #include "busybox.h" |
33 | 16 | ||
34 | #define FSIZE_MAX 32768 | 17 | #define FSIZE_MAX 32768 |
@@ -917,21 +900,21 @@ static int diffreg(char *ofile1, char *ofile2, int flags) | |||
917 | goto closem; | 900 | goto closem; |
918 | 901 | ||
919 | if (flags & D_EMPTY1) | 902 | if (flags & D_EMPTY1) |
920 | f1 = bb_xfopen(bb_dev_null, "r"); | 903 | f1 = xfopen(bb_dev_null, "r"); |
921 | else { | 904 | else { |
922 | if (strcmp(file1, "-") == 0) | 905 | if (strcmp(file1, "-") == 0) |
923 | f1 = stdin; | 906 | f1 = stdin; |
924 | else | 907 | else |
925 | f1 = bb_xfopen(file1, "r"); | 908 | f1 = xfopen(file1, "r"); |
926 | } | 909 | } |
927 | 910 | ||
928 | if (flags & D_EMPTY2) | 911 | if (flags & D_EMPTY2) |
929 | f2 = bb_xfopen(bb_dev_null, "r"); | 912 | f2 = xfopen(bb_dev_null, "r"); |
930 | else { | 913 | else { |
931 | if (strcmp(file2, "-") == 0) | 914 | if (strcmp(file2, "-") == 0) |
932 | f2 = stdin; | 915 | f2 = stdin; |
933 | else | 916 | else |
934 | f2 = bb_xfopen(file2, "r"); | 917 | f2 = xfopen(file2, "r"); |
935 | } | 918 | } |
936 | 919 | ||
937 | if ((i = files_differ(f1, f2, flags)) == 0) | 920 | if ((i = files_differ(f1, f2, flags)) == 0) |
@@ -1004,19 +987,19 @@ static void do_diff(char *dir1, char *path1, char *dir2, char *path2) | |||
1004 | int flags = D_HEADER; | 987 | int flags = D_HEADER; |
1005 | int val; | 988 | int val; |
1006 | 989 | ||
1007 | char *fullpath1 = bb_xasprintf("%s/%s", dir1, path1); | 990 | char *fullpath1 = xasprintf("%s/%s", dir1, path1); |
1008 | char *fullpath2 = bb_xasprintf("%s/%s", dir2, path2); | 991 | char *fullpath2 = xasprintf("%s/%s", dir2, path2); |
1009 | 992 | ||
1010 | if (stat(fullpath1, &stb1) != 0) { | 993 | if (stat(fullpath1, &stb1) != 0) { |
1011 | flags |= D_EMPTY1; | 994 | flags |= D_EMPTY1; |
1012 | memset(&stb1, 0, sizeof(stb1)); | 995 | memset(&stb1, 0, sizeof(stb1)); |
1013 | fullpath1 = bb_xasprintf("%s/%s", dir1, path2); | 996 | fullpath1 = xasprintf("%s/%s", dir1, path2); |
1014 | } | 997 | } |
1015 | if (stat(fullpath2, &stb2) != 0) { | 998 | if (stat(fullpath2, &stb2) != 0) { |
1016 | flags |= D_EMPTY2; | 999 | flags |= D_EMPTY2; |
1017 | memset(&stb2, 0, sizeof(stb2)); | 1000 | memset(&stb2, 0, sizeof(stb2)); |
1018 | stb2.st_mode = stb1.st_mode; | 1001 | stb2.st_mode = stb1.st_mode; |
1019 | fullpath2 = bb_xasprintf("%s/%s", dir2, path1); | 1002 | fullpath2 = xasprintf("%s/%s", dir2, path1); |
1020 | } | 1003 | } |
1021 | 1004 | ||
1022 | if (stb1.st_mode == 0) | 1005 | if (stb1.st_mode == 0) |
@@ -1051,7 +1034,7 @@ static int add_to_dirlist(const char *filename, | |||
1051 | { | 1034 | { |
1052 | dl_count++; | 1035 | dl_count++; |
1053 | dl = xrealloc(dl, dl_count * sizeof(char *)); | 1036 | dl = xrealloc(dl, dl_count * sizeof(char *)); |
1054 | dl[dl_count - 1] = bb_xstrdup(filename); | 1037 | dl[dl_count - 1] = xstrdup(filename); |
1055 | if (cmd_flags & FLAG_r) { | 1038 | if (cmd_flags & FLAG_r) { |
1056 | int *pp = (int *) userdata; | 1039 | int *pp = (int *) userdata; |
1057 | int path_len = *pp + 1; | 1040 | int path_len = *pp + 1; |
@@ -1077,7 +1060,7 @@ static char **get_dir(char *path) | |||
1077 | int path_len = strlen(path); | 1060 | int path_len = strlen(path); |
1078 | void *userdata = &path_len; | 1061 | void *userdata = &path_len; |
1079 | 1062 | ||
1080 | /* Reset dl_count - there's no need to free dl as bb_xrealloc does | 1063 | /* Reset dl_count - there's no need to free dl as xrealloc does |
1081 | * the job nicely. */ | 1064 | * the job nicely. */ |
1082 | dl_count = 0; | 1065 | dl_count = 0; |
1083 | 1066 | ||
@@ -1089,7 +1072,7 @@ static char **get_dir(char *path) | |||
1089 | DIR *dp; | 1072 | DIR *dp; |
1090 | struct dirent *ep; | 1073 | struct dirent *ep; |
1091 | 1074 | ||
1092 | dp = bb_opendir(path); | 1075 | dp = warn_opendir(path); |
1093 | while ((ep = readdir(dp))) { | 1076 | while ((ep = readdir(dp))) { |
1094 | if ((!strcmp(ep->d_name, "..")) || (!strcmp(ep->d_name, "."))) | 1077 | if ((!strcmp(ep->d_name, "..")) || (!strcmp(ep->d_name, "."))) |
1095 | continue; | 1078 | continue; |
@@ -1104,7 +1087,7 @@ static char **get_dir(char *path) | |||
1104 | /* Copy dl so that we can return it. */ | 1087 | /* Copy dl so that we can return it. */ |
1105 | retval = xmalloc(dl_count * sizeof(char *)); | 1088 | retval = xmalloc(dl_count * sizeof(char *)); |
1106 | for (i = 0; i < dl_count; i++) | 1089 | for (i = 0; i < dl_count; i++) |
1107 | retval[i] = bb_xstrdup(dl[i]); | 1090 | retval[i] = xstrdup(dl[i]); |
1108 | 1091 | ||
1109 | return retval; | 1092 | return retval; |
1110 | } | 1093 | } |
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index 5bf16e5af..19f1a3257 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c | |||
@@ -12,10 +12,6 @@ | |||
12 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 12 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <string.h> | ||
16 | #include <unistd.h> | ||
17 | #include <stdint.h> | ||
18 | #include <fcntl.h> | ||
19 | #include "busybox.h" | 15 | #include "busybox.h" |
20 | 16 | ||
21 | enum ConvType { | 17 | enum ConvType { |
@@ -30,7 +26,7 @@ static int convert(char *fn) | |||
30 | int i; | 26 | int i; |
31 | 27 | ||
32 | if (fn != NULL) { | 28 | if (fn != NULL) { |
33 | in = bb_xfopen(fn, "rw"); | 29 | in = xfopen(fn, "rw"); |
34 | /* | 30 | /* |
35 | The file is then created with mode read/write and | 31 | The file is then created with mode read/write and |
36 | permissions 0666 for glibc 2.0.6 and earlier or | 32 | permissions 0666 for glibc 2.0.6 and earlier or |
diff --git a/coreutils/expr.c b/coreutils/expr.c index 725196039..0a1baa19d 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -25,14 +25,8 @@ | |||
25 | 25 | ||
26 | /* no getopt needed */ | 26 | /* no getopt needed */ |
27 | 27 | ||
28 | #include <stdio.h> | ||
29 | #include <string.h> | ||
30 | #include <stdlib.h> | ||
31 | #include <regex.h> | ||
32 | #include <sys/types.h> | ||
33 | #include <errno.h> | ||
34 | #include "busybox.h" | 28 | #include "busybox.h" |
35 | 29 | #include "xregex.h" | |
36 | 30 | ||
37 | /* The kinds of value we can have. */ | 31 | /* The kinds of value we can have. */ |
38 | enum valtype { | 32 | enum valtype { |
@@ -116,9 +110,9 @@ static VALUE *str_value (char *s) | |||
116 | { | 110 | { |
117 | VALUE *v; | 111 | VALUE *v; |
118 | 112 | ||
119 | v = xmalloc (sizeof(VALUE)); | 113 | v = xmalloc(sizeof(VALUE)); |
120 | v->type = string; | 114 | v->type = string; |
121 | v->u.s = bb_xstrdup (s); | 115 | v->u.s = xstrdup(s); |
122 | return v; | 116 | return v; |
123 | } | 117 | } |
124 | 118 | ||
@@ -148,7 +142,7 @@ static int null (VALUE *v) | |||
148 | static void tostring (VALUE *v) | 142 | static void tostring (VALUE *v) |
149 | { | 143 | { |
150 | if (v->type == integer) { | 144 | if (v->type == integer) { |
151 | v->u.s = bb_xasprintf ("%" PF_REZ "d", PF_REZ_TYPE v->u.i); | 145 | v->u.s = xasprintf("%" PF_REZ "d", PF_REZ_TYPE v->u.i); |
152 | v->type = string; | 146 | v->type = string; |
153 | } | 147 | } |
154 | } | 148 | } |
@@ -366,7 +360,7 @@ static VALUE *eval6 (void) | |||
366 | else { | 360 | else { |
367 | v = xmalloc (sizeof(VALUE)); | 361 | v = xmalloc (sizeof(VALUE)); |
368 | v->type = string; | 362 | v->type = string; |
369 | v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i); | 363 | v->u.s = xstrndup(l->u.s + i1->u.i - 1, i2->u.i); |
370 | } | 364 | } |
371 | freev (l); | 365 | freev (l); |
372 | freev (i1); | 366 | freev (i1); |
diff --git a/coreutils/fold.c b/coreutils/fold.c index 665b93e6e..aff7bb1d9 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c | |||
@@ -10,13 +10,6 @@ | |||
10 | Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 10 | Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <ctype.h> | ||
14 | #include <errno.h> | ||
15 | #include <stdio.h> | ||
16 | #include <stdlib.h> | ||
17 | #include <string.h> | ||
18 | #include <sys/types.h> | ||
19 | #include <unistd.h> | ||
20 | #include "busybox.h" | 13 | #include "busybox.h" |
21 | 14 | ||
22 | static unsigned long flags; | 15 | static unsigned long flags; |
@@ -61,7 +54,7 @@ int fold_main(int argc, char **argv) | |||
61 | if (*a == '-' && !a[1]) | 54 | if (*a == '-' && !a[1]) |
62 | break; | 55 | break; |
63 | if (isdigit(*a)) { | 56 | if (isdigit(*a)) { |
64 | argv[i] = bb_xasprintf("-w%s", a); | 57 | argv[i] = xasprintf("-w%s", a); |
65 | } | 58 | } |
66 | } | 59 | } |
67 | } | 60 | } |
diff --git a/coreutils/head.c b/coreutils/head.c index 184e8161c..e961ca6b6 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -11,11 +11,6 @@ | |||
11 | /* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */ | 11 | /* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */ |
12 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */ | 12 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */ |
13 | 13 | ||
14 | #include <stdio.h> | ||
15 | #include <stdlib.h> | ||
16 | #include <limits.h> | ||
17 | #include <ctype.h> | ||
18 | #include <unistd.h> | ||
19 | #include "busybox.h" | 14 | #include "busybox.h" |
20 | 15 | ||
21 | static const char head_opts[] = | 16 | static const char head_opts[] = |
@@ -137,7 +132,7 @@ int head_main(int argc, char **argv) | |||
137 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ | 132 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ |
138 | retval = EXIT_FAILURE; | 133 | retval = EXIT_FAILURE; |
139 | } | 134 | } |
140 | bb_xferror_stdout(); | 135 | xferror_stdout(); |
141 | } | 136 | } |
142 | fmt = header_fmt_str; | 137 | fmt = header_fmt_str; |
143 | } while (*++argv); | 138 | } while (*++argv); |
diff --git a/coreutils/ln.c b/coreutils/ln.c index 54ced0b89..df183581e 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -11,10 +11,6 @@ | |||
11 | /* BB_AUDIT GNU options missing: -d, -F, -i, and -v. */ | 11 | /* BB_AUDIT GNU options missing: -d, -F, -i, and -v. */ |
12 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/ln.html */ | 12 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/ln.html */ |
13 | 13 | ||
14 | #include <stdio.h> | ||
15 | #include <stdlib.h> | ||
16 | #include <unistd.h> | ||
17 | #include <errno.h> | ||
18 | #include "busybox.h" | 14 | #include "busybox.h" |
19 | 15 | ||
20 | #define LN_SYMLINK 1 | 16 | #define LN_SYMLINK 1 |
@@ -45,7 +41,7 @@ int ln_main(int argc, char **argv) | |||
45 | 41 | ||
46 | if (argc == optind + 1) { | 42 | if (argc == optind + 1) { |
47 | *--argv = last; | 43 | *--argv = last; |
48 | last = bb_get_last_path_component(bb_xstrdup(last)); | 44 | last = bb_get_last_path_component(xstrdup(last)); |
49 | } | 45 | } |
50 | 46 | ||
51 | do { | 47 | do { |
@@ -55,7 +51,7 @@ int ln_main(int argc, char **argv) | |||
55 | if (is_directory(src, | 51 | if (is_directory(src, |
56 | (flag & LN_NODEREFERENCE) ^ LN_NODEREFERENCE, | 52 | (flag & LN_NODEREFERENCE) ^ LN_NODEREFERENCE, |
57 | NULL)) { | 53 | NULL)) { |
58 | src_name = bb_xstrdup(*argv); | 54 | src_name = xstrdup(*argv); |
59 | src = concat_path_file(src, bb_get_last_path_component(src_name)); | 55 | src = concat_path_file(src, bb_get_last_path_component(src_name)); |
60 | free(src_name); | 56 | free(src_name); |
61 | src_name = src; | 57 | src_name = src; |
@@ -69,7 +65,7 @@ int ln_main(int argc, char **argv) | |||
69 | 65 | ||
70 | if (flag & LN_BACKUP) { | 66 | if (flag & LN_BACKUP) { |
71 | char *backup; | 67 | char *backup; |
72 | backup = bb_xasprintf("%s%s", src, suffix); | 68 | backup = xasprintf("%s%s", src, suffix); |
73 | if (rename(src, backup) < 0 && errno != ENOENT) { | 69 | if (rename(src, backup) < 0 && errno != ENOENT) { |
74 | bb_perror_msg("%s", src); | 70 | bb_perror_msg("%s", src); |
75 | status = EXIT_FAILURE; | 71 | status = EXIT_FAILURE; |
diff --git a/coreutils/ls.c b/coreutils/ls.c index de8405dab..6b9fbbfc9 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -37,15 +37,7 @@ enum { | |||
37 | /************************************************************************/ | 37 | /************************************************************************/ |
38 | 38 | ||
39 | #include "busybox.h" | 39 | #include "busybox.h" |
40 | #include <unistd.h> | 40 | #include <getopt.h> |
41 | #include <errno.h> | ||
42 | #include <string.h> | ||
43 | #include <fcntl.h> | ||
44 | #include <signal.h> | ||
45 | #include <getopt.h> /* struct option */ | ||
46 | #include <sys/ioctl.h> | ||
47 | #include <sys/sysmacros.h> /* major() and minor() */ | ||
48 | #include <time.h> | ||
49 | 41 | ||
50 | /* what is the overall style of the listing */ | 42 | /* what is the overall style of the listing */ |
51 | #define STYLE_COLUMNS (1U<<21) /* fill columns */ | 43 | #define STYLE_COLUMNS (1U<<21) /* fill columns */ |
@@ -535,7 +527,7 @@ static struct dnode **list_dir(const char *path) | |||
535 | 527 | ||
536 | dn = NULL; | 528 | dn = NULL; |
537 | nfiles = 0; | 529 | nfiles = 0; |
538 | dir = bb_opendir(path); | 530 | dir = warn_opendir(path); |
539 | if (dir == NULL) { | 531 | if (dir == NULL) { |
540 | status = EXIT_FAILURE; | 532 | status = EXIT_FAILURE; |
541 | return (NULL); /* could not open the dir */ | 533 | return (NULL); /* could not open the dir */ |
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index aea43ff8c..49766a925 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -6,14 +6,6 @@ | |||
6 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 6 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <fcntl.h> | ||
10 | #include <limits.h> | ||
11 | #include <stdio.h> | ||
12 | #include <stdint.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <string.h> | ||
15 | #include <unistd.h> | ||
16 | |||
17 | #include "busybox.h" | 9 | #include "busybox.h" |
18 | 10 | ||
19 | typedef enum { HASH_SHA1, HASH_MD5 } hash_algo_t; | 11 | typedef enum { HASH_SHA1, HASH_MD5 } hash_algo_t; |
@@ -129,7 +121,7 @@ static int hash_files(int argc, char **argv, hash_algo_t hash_algo) | |||
129 | if (strcmp(file_ptr, "-") == 0) { | 121 | if (strcmp(file_ptr, "-") == 0) { |
130 | pre_computed_stream = stdin; | 122 | pre_computed_stream = stdin; |
131 | } else { | 123 | } else { |
132 | pre_computed_stream = bb_xfopen(file_ptr, "r"); | 124 | pre_computed_stream = xfopen(file_ptr, "r"); |
133 | } | 125 | } |
134 | 126 | ||
135 | while ((line = bb_get_chomped_line_from_file(pre_computed_stream)) != NULL) { | 127 | while ((line = bb_get_chomped_line_from_file(pre_computed_stream)) != NULL) { |
diff --git a/coreutils/nohup.c b/coreutils/nohup.c index 41c4b779c..86d788683 100644 --- a/coreutils/nohup.c +++ b/coreutils/nohup.c | |||
@@ -9,9 +9,6 @@ | |||
9 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 9 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <fcntl.h> | ||
13 | #include <signal.h> | ||
14 | #include <unistd.h> | ||
15 | #include "busybox.h" | 12 | #include "busybox.h" |
16 | 13 | ||
17 | int nohup_main(int argc, char *argv[]) | 14 | int nohup_main(int argc, char *argv[]) |
@@ -25,7 +22,7 @@ int nohup_main(int argc, char *argv[]) | |||
25 | 22 | ||
26 | if (argc<2) bb_show_usage(); | 23 | if (argc<2) bb_show_usage(); |
27 | 24 | ||
28 | nullfd = bb_xopen(bb_dev_null, O_WRONLY|O_APPEND); | 25 | nullfd = xopen(bb_dev_null, O_WRONLY|O_APPEND); |
29 | // If stdin is a tty, detach from it. | 26 | // If stdin is a tty, detach from it. |
30 | 27 | ||
31 | if (isatty(0)) dup2(nullfd, 0); | 28 | if (isatty(0)) dup2(nullfd, 0); |
@@ -38,7 +35,7 @@ int nohup_main(int argc, char *argv[]) | |||
38 | home = getenv("HOME"); | 35 | home = getenv("HOME"); |
39 | if (home) { | 36 | if (home) { |
40 | home = concat_path_file(home, nohupout); | 37 | home = concat_path_file(home, nohupout); |
41 | bb_xopen3(nohupout, O_CREAT|O_WRONLY|O_APPEND, S_IRUSR|S_IWUSR); | 38 | xopen3(nohupout, O_CREAT|O_WRONLY|O_APPEND, S_IRUSR|S_IWUSR); |
42 | } | 39 | } |
43 | } | 40 | } |
44 | } else dup2(nullfd, 1); | 41 | } else dup2(nullfd, 1); |
diff --git a/coreutils/sort.c b/coreutils/sort.c index 3354385a4..195e13d13 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -12,13 +12,6 @@ | |||
12 | * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html | 12 | * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <ctype.h> | ||
16 | #include <math.h> | ||
17 | #include <stdio.h> | ||
18 | #include <stdlib.h> | ||
19 | #include <string.h> | ||
20 | #include <time.h> | ||
21 | #include <unistd.h> | ||
22 | #include "busybox.h" | 15 | #include "busybox.h" |
23 | 16 | ||
24 | static int global_flags; | 17 | static int global_flags; |
@@ -104,7 +97,7 @@ static char *get_key(char *str, struct sort_key *key, int flags) | |||
104 | } | 97 | } |
105 | /* Make the copy */ | 98 | /* Make the copy */ |
106 | if(end<start) end=start; | 99 | if(end<start) end=start; |
107 | str=bb_xstrndup(str+start,end-start); | 100 | str=xstrndup(str+start,end-start); |
108 | /* Handle -d */ | 101 | /* Handle -d */ |
109 | if(flags&FLAG_d) { | 102 | if(flags&FLAG_d) { |
110 | for(start=end=0;str[end];end++) | 103 | for(start=end=0;str[end];end++) |
@@ -222,7 +215,6 @@ static int compare_keys(const void *xarg, const void *yarg) | |||
222 | /* Perform fallback sort if necessary */ | 215 | /* Perform fallback sort if necessary */ |
223 | if(!retval && !(global_flags&FLAG_s)) | 216 | if(!retval && !(global_flags&FLAG_s)) |
224 | retval=strcmp(*(char **)xarg, *(char **)yarg); | 217 | retval=strcmp(*(char **)xarg, *(char **)yarg); |
225 | //dprintf(2,"reverse=%d\n",flags&FLAG_r); | ||
226 | return ((flags&FLAG_r)?-1:1)*retval; | 218 | return ((flags&FLAG_r)?-1:1)*retval; |
227 | } | 219 | } |
228 | 220 | ||
@@ -242,7 +234,7 @@ int sort_main(int argc, char **argv) | |||
242 | #ifdef CONFIG_FEATURE_SORT_BIG | 234 | #ifdef CONFIG_FEATURE_SORT_BIG |
243 | case 'o': | 235 | case 'o': |
244 | if(outfile) bb_error_msg_and_die("Too many -o."); | 236 | if(outfile) bb_error_msg_and_die("Too many -o."); |
245 | outfile=bb_xfopen(optarg,"w"); | 237 | outfile=xfopen(optarg,"w"); |
246 | break; | 238 | break; |
247 | case 't': | 239 | case 't': |
248 | if(key_separator || optarg[1]) | 240 | if(key_separator || optarg[1]) |
@@ -289,7 +281,7 @@ int sort_main(int argc, char **argv) | |||
289 | /* Open input files and read data */ | 281 | /* Open input files and read data */ |
290 | for(i=argv[optind] ? optind : optind-1;argv[i];i++) { | 282 | for(i=argv[optind] ? optind : optind-1;argv[i];i++) { |
291 | if(i<optind || (*argv[i]=='-' && !argv[i][1])) fp=stdin; | 283 | if(i<optind || (*argv[i]=='-' && !argv[i][1])) fp=stdin; |
292 | else fp=bb_xfopen(argv[i],"r"); | 284 | else fp=xfopen(argv[i],"r"); |
293 | for(;;) { | 285 | for(;;) { |
294 | line=GET_LINE(fp); | 286 | line=GET_LINE(fp); |
295 | if(!line) break; | 287 | if(!line) break; |
diff --git a/coreutils/stat.c b/coreutils/stat.c index 7e39d5ecd..8e0121849 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -12,18 +12,6 @@ | |||
12 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 12 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <stdio.h> | ||
16 | #include <stdint.h> | ||
17 | #include <sys/types.h> | ||
18 | #include <pwd.h> | ||
19 | #include <grp.h> | ||
20 | #include <sys/vfs.h> | ||
21 | #include <time.h> | ||
22 | #include <getopt.h> /* optind */ | ||
23 | #include <sys/stat.h> | ||
24 | #include <sys/statfs.h> | ||
25 | #include <sys/statvfs.h> | ||
26 | #include <string.h> | ||
27 | #include "busybox.h" | 15 | #include "busybox.h" |
28 | 16 | ||
29 | /* vars to control behavior */ | 17 | /* vars to control behavior */ |
@@ -321,7 +309,7 @@ static void print_it(char const *masterformat, char const *filename, | |||
321 | char *b; | 309 | char *b; |
322 | 310 | ||
323 | /* create a working copy of the format string */ | 311 | /* create a working copy of the format string */ |
324 | char *format = bb_xstrdup(masterformat); | 312 | char *format = xstrdup(masterformat); |
325 | 313 | ||
326 | /* Add 2 to accommodate our conversion of the stat `%s' format string | 314 | /* Add 2 to accommodate our conversion of the stat `%s' format string |
327 | * to the printf `%llu' one. */ | 315 | * to the printf `%llu' one. */ |
diff --git a/coreutils/stty.c b/coreutils/stty.c index b78368e7b..073de847b 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -21,31 +21,7 @@ | |||
21 | 21 | ||
22 | */ | 22 | */ |
23 | 23 | ||
24 | //#define TEST | ||
25 | |||
26 | #include "busybox.h" | 24 | #include "busybox.h" |
27 | #include <stddef.h> | ||
28 | #include <termios.h> | ||
29 | #include <sys/ioctl.h> | ||
30 | |||
31 | #include <sys/param.h> | ||
32 | #include <unistd.h> | ||
33 | |||
34 | #ifndef STDIN_FILENO | ||
35 | # define STDIN_FILENO 0 | ||
36 | #endif | ||
37 | |||
38 | #ifndef STDOUT_FILENO | ||
39 | # define STDOUT_FILENO 1 | ||
40 | #endif | ||
41 | |||
42 | #include <stdlib.h> | ||
43 | #include <string.h> | ||
44 | #include <assert.h> | ||
45 | #include <ctype.h> | ||
46 | #include <errno.h> | ||
47 | #include <limits.h> | ||
48 | #include <fcntl.h> | ||
49 | 25 | ||
50 | #define STREQ(a, b) (strcmp ((a), (b)) == 0) | 26 | #define STREQ(a, b) (strcmp ((a), (b)) == 0) |
51 | 27 | ||
@@ -469,11 +445,7 @@ static const struct suffix_mult stty_suffixes[] = { | |||
469 | {NULL, 0 } | 445 | {NULL, 0 } |
470 | }; | 446 | }; |
471 | 447 | ||
472 | #ifndef TEST | ||
473 | int stty_main(int argc, char **argv) | 448 | int stty_main(int argc, char **argv) |
474 | #else | ||
475 | int main(int argc, char **argv) | ||
476 | #endif | ||
477 | { | 449 | { |
478 | struct termios mode; | 450 | struct termios mode; |
479 | void (*output_func)(struct termios *); | 451 | void (*output_func)(struct termios *); |
@@ -541,7 +513,7 @@ int main(int argc, char **argv) | |||
541 | 513 | ||
542 | device_name = file_name; | 514 | device_name = file_name; |
543 | fclose(stdin); | 515 | fclose(stdin); |
544 | bb_xopen(device_name, O_RDONLY | O_NONBLOCK); | 516 | xopen(device_name, O_RDONLY | O_NONBLOCK); |
545 | if ((fdflags = fcntl(STDIN_FILENO, F_GETFL)) == -1 | 517 | if ((fdflags = fcntl(STDIN_FILENO, F_GETFL)) == -1 |
546 | || fcntl(STDIN_FILENO, F_SETFL, fdflags & ~O_NONBLOCK) < 0) | 518 | || fcntl(STDIN_FILENO, F_SETFL, fdflags & ~O_NONBLOCK) < 0) |
547 | perror_on_device("%s: couldn't reset non-blocking mode"); | 519 | perror_on_device("%s: couldn't reset non-blocking mode"); |
@@ -1299,9 +1271,3 @@ static const char *visible(unsigned int ch) | |||
1299 | *bpout = '\0'; | 1271 | *bpout = '\0'; |
1300 | return (const char *) buf; | 1272 | return (const char *) buf; |
1301 | } | 1273 | } |
1302 | |||
1303 | #ifdef TEST | ||
1304 | |||
1305 | const char *bb_applet_name = "stty"; | ||
1306 | |||
1307 | #endif | ||
diff --git a/coreutils/tee.c b/coreutils/tee.c index 30496eefa..4d0e6ff85 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -10,10 +10,6 @@ | |||
10 | /* BB_AUDIT SUSv3 compliant */ | 10 | /* BB_AUDIT SUSv3 compliant */ |
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */ |
12 | 12 | ||
13 | #include <stdio.h> | ||
14 | #include <stdlib.h> | ||
15 | #include <signal.h> | ||
16 | #include <unistd.h> | ||
17 | #include "busybox.h" | 13 | #include "busybox.h" |
18 | 14 | ||
19 | int tee_main(int argc, char **argv) | 15 | int tee_main(int argc, char **argv) |
@@ -96,7 +92,7 @@ int tee_main(int argc, char **argv) | |||
96 | do { /* Now check for (input and) output errors. */ | 92 | do { /* Now check for (input and) output errors. */ |
97 | /* Checking ferror should be sufficient, but we may want to fclose. | 93 | /* Checking ferror should be sufficient, but we may want to fclose. |
98 | * If we do, remember not to close stdin! */ | 94 | * If we do, remember not to close stdin! */ |
99 | bb_xferror(*p, filenames[(int)(p - files)]); | 95 | xferror(*p, filenames[(int)(p - files)]); |
100 | } while (*++p); | 96 | } while (*++p); |
101 | 97 | ||
102 | bb_fflush_stdout_and_exit(retval); | 98 | bb_fflush_stdout_and_exit(retval); |
diff --git a/coreutils/uniq.c b/coreutils/uniq.c index 956c50796..26afc00f4 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c | |||
@@ -11,9 +11,6 @@ | |||
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */ |
12 | 12 | ||
13 | #include "busybox.h" | 13 | #include "busybox.h" |
14 | #include <string.h> | ||
15 | #include <ctype.h> | ||
16 | #include <unistd.h> | ||
17 | 14 | ||
18 | static const char uniq_opts[] = "f:s:" "cdu\0\1\2\4"; | 15 | static const char uniq_opts[] = "f:s:" "cdu\0\1\2\4"; |
19 | 16 | ||
@@ -23,7 +20,7 @@ static FILE *xgetoptfile_uniq_s(char **argv, int read0write2) | |||
23 | 20 | ||
24 | if ((n = *argv) != NULL) { | 21 | if ((n = *argv) != NULL) { |
25 | if ((*n != '-') || n[1]) { | 22 | if ((*n != '-') || n[1]) { |
26 | return bb_xfopen(n, "r\0w" + read0write2); | 23 | return xfopen(n, "r\0w" + read0write2); |
27 | } | 24 | } |
28 | } | 25 | } |
29 | return (read0write2) ? stdout : stdin; | 26 | return (read0write2) ? stdout : stdin; |
@@ -100,7 +97,7 @@ int uniq_main(int argc, char **argv) | |||
100 | } | 97 | } |
101 | } while (s1); | 98 | } while (s1); |
102 | 99 | ||
103 | bb_xferror(in, input_filename); | 100 | xferror(in, input_filename); |
104 | 101 | ||
105 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); | 102 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); |
106 | } | 103 | } |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 06b2fc1c1..6050c0af7 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -12,11 +12,6 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | 14 | ||
15 | #include <stdio.h> | ||
16 | #include <errno.h> | ||
17 | #include <getopt.h> /* optind */ | ||
18 | #include <string.h> | ||
19 | #include <stdlib.h> | ||
20 | #include "busybox.h" | 15 | #include "busybox.h" |
21 | 16 | ||
22 | static int read_stduu(FILE *src_stream, FILE *dst_stream) | 17 | static int read_stduu(FILE *src_stream, FILE *dst_stream) |
@@ -141,7 +136,7 @@ int uudecode_main(int argc, char **argv) | |||
141 | if (optind == argc) { | 136 | if (optind == argc) { |
142 | src_stream = stdin; | 137 | src_stream = stdin; |
143 | } else if (optind + 1 == argc) { | 138 | } else if (optind + 1 == argc) { |
144 | src_stream = bb_xfopen(argv[optind], "r"); | 139 | src_stream = xfopen(argv[optind], "r"); |
145 | } else { | 140 | } else { |
146 | bb_show_usage(); | 141 | bb_show_usage(); |
147 | } | 142 | } |
@@ -174,7 +169,7 @@ int uudecode_main(int argc, char **argv) | |||
174 | if (strcmp(outname, "-") == 0) { | 169 | if (strcmp(outname, "-") == 0) { |
175 | dst_stream = stdout; | 170 | dst_stream = stdout; |
176 | } else { | 171 | } else { |
177 | dst_stream = bb_xfopen(outname, "w"); | 172 | dst_stream = xfopen(outname, "w"); |
178 | chmod(outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)); | 173 | chmod(outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)); |
179 | } | 174 | } |
180 | free(line); | 175 | free(line); |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index fee408605..1449d9aeb 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -7,12 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ | 9 | */ |
10 | #include <stdio.h> | 10 | |
11 | #include <string.h> | ||
12 | #include <stdlib.h> | ||
13 | #include <sys/types.h> | ||
14 | #include <sys/stat.h> | ||
15 | #include <unistd.h> | ||
16 | #include "busybox.h" | 11 | #include "busybox.h" |
17 | 12 | ||
18 | /* Conversion table. for base 64 */ | 13 | /* Conversion table. for base 64 */ |
@@ -92,7 +87,7 @@ int uuencode_main(int argc, char **argv) | |||
92 | 87 | ||
93 | switch (argc - optind) { | 88 | switch (argc - optind) { |
94 | case 2: | 89 | case 2: |
95 | src_stream = bb_xfopen(argv[optind], "r"); | 90 | src_stream = xfopen(argv[optind], "r"); |
96 | xstat(argv[optind], &stat_buf); | 91 | xstat(argv[optind], &stat_buf); |
97 | mode = stat_buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); | 92 | mode = stat_buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); |
98 | if (src_stream == stdout) { | 93 | if (src_stream == stdout) { |
@@ -128,7 +123,7 @@ int uuencode_main(int argc, char **argv) | |||
128 | } | 123 | } |
129 | bb_printf(tbl == tbl_std ? "\n`\nend\n" : "\n====\n"); | 124 | bb_printf(tbl == tbl_std ? "\n`\nend\n" : "\n====\n"); |
130 | 125 | ||
131 | bb_xferror(src_stream, "source"); /* TODO - Fix this! */ | 126 | xferror(src_stream, "source"); /* TODO - Fix this! */ |
132 | 127 | ||
133 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); | 128 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); |
134 | } | 129 | } |
diff --git a/coreutils/watch.c b/coreutils/watch.c index b783d34de..c8b16b908 100644 --- a/coreutils/watch.c +++ b/coreutils/watch.c | |||
@@ -16,14 +16,6 @@ | |||
16 | * reduced size. | 16 | * reduced size. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <stdio.h> | ||
20 | #include <stdlib.h> | ||
21 | #include <string.h> | ||
22 | #include <limits.h> | ||
23 | #include <time.h> | ||
24 | #include <assert.h> | ||
25 | #include <unistd.h> | ||
26 | #include <sys/wait.h> | ||
27 | #include "busybox.h" | 19 | #include "busybox.h" |
28 | 20 | ||
29 | int watch_main(int argc, char **argv) | 21 | int watch_main(int argc, char **argv) |
@@ -62,7 +54,7 @@ int watch_main(int argc, char **argv) | |||
62 | 54 | ||
63 | printf("\033[H\033[J%s %s\n", header, thyme); | 55 | printf("\033[H\033[J%s %s\n", header, thyme); |
64 | 56 | ||
65 | waitpid(bb_xspawn(watched_argv),0,0); | 57 | waitpid(xspawn(watched_argv),0,0); |
66 | sleep(period); | 58 | sleep(period); |
67 | } | 59 | } |
68 | } | 60 | } |