diff options
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/adjtimex.c | 6 | ||||
-rw-r--r-- | miscutils/crond.c | 10 | ||||
-rw-r--r-- | miscutils/crontab.c | 28 | ||||
-rw-r--r-- | miscutils/dc.c | 10 | ||||
-rw-r--r-- | miscutils/dutmp.c | 95 | ||||
-rw-r--r-- | miscutils/makedevs.c | 8 | ||||
-rw-r--r-- | miscutils/mt.c | 12 | ||||
-rw-r--r-- | miscutils/strings.c | 4 | ||||
-rw-r--r-- | miscutils/time.c | 16 | ||||
-rw-r--r-- | miscutils/update.c | 4 | ||||
-rw-r--r-- | miscutils/watchdog.c | 4 |
11 files changed, 108 insertions, 89 deletions
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index 848f7340e..d541848f0 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c | |||
@@ -87,7 +87,7 @@ void usage(char *prog) | |||
87 | "Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] [ -t tick ]\n", | 87 | "Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] [ -t tick ]\n", |
88 | prog); | 88 | prog); |
89 | } | 89 | } |
90 | #define show_usage() usage(argv[0]) | 90 | #define bb_show_usage() usage(argv[0]) |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | int main(int argc, char ** argv) | 93 | int main(int argc, char ** argv) |
@@ -121,12 +121,12 @@ int main(int argc, char ** argv) | |||
121 | txc.modes |= ADJ_TICK; | 121 | txc.modes |= ADJ_TICK; |
122 | break; | 122 | break; |
123 | default: | 123 | default: |
124 | show_usage(); | 124 | bb_show_usage(); |
125 | exit(1); | 125 | exit(1); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | if (argc != optind) { /* no valid non-option parameters */ | 128 | if (argc != optind) { /* no valid non-option parameters */ |
129 | show_usage(); | 129 | bb_show_usage(); |
130 | exit(1); | 130 | exit(1); |
131 | } | 131 | } |
132 | 132 | ||
diff --git a/miscutils/crond.c b/miscutils/crond.c index 8ae54a536..cbb4ffc58 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
@@ -154,7 +154,7 @@ crond_main(int ac, char **av) | |||
154 | if (*optarg != 0) CDir = optarg; | 154 | if (*optarg != 0) CDir = optarg; |
155 | break; | 155 | break; |
156 | default: /* parse error */ | 156 | default: /* parse error */ |
157 | show_usage(); | 157 | bb_show_usage(); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
@@ -163,7 +163,7 @@ crond_main(int ac, char **av) | |||
163 | */ | 163 | */ |
164 | 164 | ||
165 | if (chdir(CDir) != 0) | 165 | if (chdir(CDir) != 0) |
166 | perror_msg_and_die("chdir"); | 166 | bb_perror_msg_and_die("chdir"); |
167 | 167 | ||
168 | /* | 168 | /* |
169 | * close stdin and stdout, stderr. | 169 | * close stdin and stdout, stderr. |
@@ -173,7 +173,7 @@ crond_main(int ac, char **av) | |||
173 | 173 | ||
174 | if (ForegroundOpt == 0) { | 174 | if (ForegroundOpt == 0) { |
175 | if(daemon(1, 0) < 0) | 175 | if(daemon(1, 0) < 0) |
176 | perror_msg_and_die("daemon"); | 176 | bb_perror_msg_and_die("daemon"); |
177 | } | 177 | } |
178 | 178 | ||
179 | (void)startlogger(); /* need if syslog mode selected */ | 179 | (void)startlogger(); /* need if syslog mode selected */ |
@@ -268,7 +268,7 @@ vlog(int level, int MLOG_LEVEL, const char *ctl, va_list va) | |||
268 | close(logfd); | 268 | close(logfd); |
269 | } else | 269 | } else |
270 | #ifdef FEATURE_DEBUG_OPT | 270 | #ifdef FEATURE_DEBUG_OPT |
271 | perror_msg("Can't open log file") | 271 | bb_perror_msg("Can't open log file") |
272 | #endif | 272 | #endif |
273 | ; | 273 | ; |
274 | } | 274 | } |
@@ -385,7 +385,7 @@ startlogger(void) | |||
385 | int logfd; | 385 | int logfd; |
386 | 386 | ||
387 | if (LoggerOpt == 0) | 387 | if (LoggerOpt == 0) |
388 | openlog(applet_name, LOG_CONS|LOG_PID,LOG_CRON); | 388 | openlog(bb_applet_name, LOG_CONS|LOG_PID,LOG_CRON); |
389 | 389 | ||
390 | else { /* test logfile */ | 390 | else { /* test logfile */ |
391 | if ((logfd = open(LogFile,O_WRONLY|O_CREAT|O_APPEND,600)) >= 0) | 391 | if ((logfd = open(LogFile,O_WRONLY|O_CREAT|O_APPEND,600)) >= 0) |
diff --git a/miscutils/crontab.c b/miscutils/crontab.c index 5bd7db6e5..c6c33ace9 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c | |||
@@ -61,7 +61,7 @@ crontab_main(int ac, char **av) | |||
61 | 61 | ||
62 | UserId = getuid(); | 62 | UserId = getuid(); |
63 | if ((pas = getpwuid(UserId)) == NULL) | 63 | if ((pas = getpwuid(UserId)) == NULL) |
64 | perror_msg_and_die("getpwuid"); | 64 | bb_perror_msg_and_die("getpwuid"); |
65 | 65 | ||
66 | strncpy(caller, pas->pw_name, sizeof(caller)); | 66 | strncpy(caller, pas->pw_name, sizeof(caller)); |
67 | 67 | ||
@@ -105,10 +105,10 @@ crontab_main(int ac, char **av) | |||
105 | if (pas) { | 105 | if (pas) { |
106 | UserId = pas->pw_uid; | 106 | UserId = pas->pw_uid; |
107 | } else { | 107 | } else { |
108 | error_msg_and_die("user %s unknown", av[i]); | 108 | bb_error_msg_and_die("user %s unknown", av[i]); |
109 | } | 109 | } |
110 | } else { | 110 | } else { |
111 | error_msg_and_die("only the superuser may specify a user"); | 111 | bb_error_msg_and_die("only the superuser may specify a user"); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | break; | 114 | break; |
@@ -116,7 +116,7 @@ crontab_main(int ac, char **av) | |||
116 | if (getuid() == geteuid()) { | 116 | if (getuid() == geteuid()) { |
117 | CDir = (*ptr) ? ptr : av[++i]; | 117 | CDir = (*ptr) ? ptr : av[++i]; |
118 | } else { | 118 | } else { |
119 | error_msg_and_die("-c option: superuser only"); | 119 | bb_error_msg_and_die("-c option: superuser only"); |
120 | } | 120 | } |
121 | break; | 121 | break; |
122 | default: | 122 | default: |
@@ -125,14 +125,14 @@ crontab_main(int ac, char **av) | |||
125 | } | 125 | } |
126 | } | 126 | } |
127 | if (i != ac || option == NONE) | 127 | if (i != ac || option == NONE) |
128 | show_usage(); | 128 | bb_show_usage(); |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * Get password entry | 131 | * Get password entry |
132 | */ | 132 | */ |
133 | 133 | ||
134 | if ((pas = getpwuid(UserId)) == NULL) | 134 | if ((pas = getpwuid(UserId)) == NULL) |
135 | perror_msg_and_die("getpwuid"); | 135 | bb_perror_msg_and_die("getpwuid"); |
136 | 136 | ||
137 | /* | 137 | /* |
138 | * If there is a replacement file, obtain a secure descriptor to it. | 138 | * If there is a replacement file, obtain a secure descriptor to it. |
@@ -141,7 +141,7 @@ crontab_main(int ac, char **av) | |||
141 | if (repFile) { | 141 | if (repFile) { |
142 | repFd = GetReplaceStream(caller, repFile); | 142 | repFd = GetReplaceStream(caller, repFile); |
143 | if (repFd < 0) | 143 | if (repFd < 0) |
144 | error_msg_and_die("unable to read replacement file"); | 144 | bb_error_msg_and_die("unable to read replacement file"); |
145 | } | 145 | } |
146 | 146 | ||
147 | /* | 147 | /* |
@@ -149,7 +149,7 @@ crontab_main(int ac, char **av) | |||
149 | */ | 149 | */ |
150 | 150 | ||
151 | if (chdir(CDir) < 0) | 151 | if (chdir(CDir) < 0) |
152 | perror_msg_and_die("cannot change dir to %s", CDir); | 152 | bb_perror_msg_and_die("cannot change dir to %s", CDir); |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * Handle options as appropriate | 155 | * Handle options as appropriate |
@@ -166,7 +166,7 @@ crontab_main(int ac, char **av) | |||
166 | fputs(buf, stdout); | 166 | fputs(buf, stdout); |
167 | fclose(fi); | 167 | fclose(fi); |
168 | } else { | 168 | } else { |
169 | error_msg("no crontab for %s", pas->pw_name); | 169 | bb_error_msg("no crontab for %s", pas->pw_name); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | break; | 172 | break; |
@@ -190,7 +190,7 @@ crontab_main(int ac, char **av) | |||
190 | lseek(fd, 0L, 0); | 190 | lseek(fd, 0L, 0); |
191 | repFd = fd; | 191 | repFd = fd; |
192 | } else { | 192 | } else { |
193 | error_msg_and_die("unable to create %s", tmp); | 193 | bb_error_msg_and_die("unable to create %s", tmp); |
194 | } | 194 | } |
195 | 195 | ||
196 | } | 196 | } |
@@ -211,7 +211,7 @@ crontab_main(int ac, char **av) | |||
211 | close(fd); | 211 | close(fd); |
212 | rename(path, pas->pw_name); | 212 | rename(path, pas->pw_name); |
213 | } else { | 213 | } else { |
214 | error_msg("unable to create %s/%s", CDir, path); | 214 | bb_error_msg("unable to create %s/%s", CDir, path); |
215 | } | 215 | } |
216 | close(repFd); | 216 | close(repFd); |
217 | } | 217 | } |
@@ -244,7 +244,7 @@ crontab_main(int ac, char **av) | |||
244 | /* loop */ | 244 | /* loop */ |
245 | } | 245 | } |
246 | if (fo == NULL) { | 246 | if (fo == NULL) { |
247 | error_msg("unable to append to %s/%s", CDir, CRONUPDATE); | 247 | bb_error_msg("unable to append to %s/%s", CDir, CRONUPDATE); |
248 | } | 248 | } |
249 | } | 249 | } |
250 | return 0; | 250 | return 0; |
@@ -291,7 +291,7 @@ GetReplaceStream(const char *user, const char *file) | |||
291 | 291 | ||
292 | fd = open(file, O_RDONLY); | 292 | fd = open(file, O_RDONLY); |
293 | if (fd < 0) { | 293 | if (fd < 0) { |
294 | error_msg("unable to open %s", file); | 294 | bb_error_msg("unable to open %s", file); |
295 | exit(0); | 295 | exit(0); |
296 | } | 296 | } |
297 | buf[0] = 0; | 297 | buf[0] = 0; |
@@ -328,7 +328,7 @@ EditFile(const char *user, const char *file) | |||
328 | /* | 328 | /* |
329 | * PARENT - failure | 329 | * PARENT - failure |
330 | */ | 330 | */ |
331 | perror_msg_and_die("fork"); | 331 | bb_perror_msg_and_die("fork"); |
332 | } | 332 | } |
333 | wait4(pid, NULL, 0, NULL); | 333 | wait4(pid, NULL, 0, NULL); |
334 | } | 334 | } |
diff --git a/miscutils/dc.c b/miscutils/dc.c index c7b43ea0a..5e367fe68 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c | |||
@@ -16,14 +16,14 @@ static unsigned char base; | |||
16 | static void push(double a) | 16 | static void push(double a) |
17 | { | 17 | { |
18 | if (pointer >= (sizeof(stack) / sizeof(*stack))) | 18 | if (pointer >= (sizeof(stack) / sizeof(*stack))) |
19 | error_msg_and_die("stack overflow"); | 19 | bb_error_msg_and_die("stack overflow"); |
20 | stack[pointer++] = a; | 20 | stack[pointer++] = a; |
21 | } | 21 | } |
22 | 22 | ||
23 | static double pop(void) | 23 | static double pop(void) |
24 | { | 24 | { |
25 | if (pointer == 0) | 25 | if (pointer == 0) |
26 | error_msg_and_die("stack underflow"); | 26 | bb_error_msg_and_die("stack underflow"); |
27 | return stack[--pointer]; | 27 | return stack[--pointer]; |
28 | } | 28 | } |
29 | 29 | ||
@@ -154,7 +154,7 @@ static void stack_machine(const char *argument) | |||
154 | } | 154 | } |
155 | o++; | 155 | o++; |
156 | } | 156 | } |
157 | error_msg_and_die("%s: syntax error.", argument); | 157 | bb_error_msg_and_die("%s: syntax error.", argument); |
158 | } | 158 | } |
159 | 159 | ||
160 | /* return pointer to next token in buffer and set *buffer to one char | 160 | /* return pointer to next token in buffer and set *buffer to one char |
@@ -191,7 +191,7 @@ int dc_main(int argc, char **argv) | |||
191 | char *line = NULL; | 191 | char *line = NULL; |
192 | char *cursor = NULL; | 192 | char *cursor = NULL; |
193 | char *token = NULL; | 193 | char *token = NULL; |
194 | while ((line = get_line_from_file(stdin))) { | 194 | while ((line = bb_get_chomped_line_from_file(stdin))) { |
195 | cursor = line; | 195 | cursor = line; |
196 | len = number_of_tokens(line); | 196 | len = number_of_tokens(line); |
197 | for (i = 0; i < len; i++) { | 197 | for (i = 0; i < len; i++) { |
@@ -203,7 +203,7 @@ int dc_main(int argc, char **argv) | |||
203 | } | 203 | } |
204 | } else { | 204 | } else { |
205 | if (*argv[1]=='-') | 205 | if (*argv[1]=='-') |
206 | show_usage(); | 206 | bb_show_usage(); |
207 | while (argc >= 2) { | 207 | while (argc >= 2) { |
208 | stack_machine(argv[1]); | 208 | stack_machine(argv[1]); |
209 | argv++; | 209 | argv++; |
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index 19e09fbb0..113f850fe 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c | |||
@@ -8,57 +8,76 @@ | |||
8 | * versions of 'who', 'last', etc. IP Addr is output in hex, | 8 | * versions of 'who', 'last', etc. IP Addr is output in hex, |
9 | * little endian on x86. | 9 | * little endian on x86. |
10 | * | 10 | * |
11 | * Modified to support all sorts of libcs by | ||
12 | * Erik Andersen <andersen@lineo.com> | ||
13 | */ | 11 | */ |
14 | 12 | ||
15 | #include <sys/types.h> | 13 | /* Mar 13, 2003 Manuel Novoa III |
16 | #include <fcntl.h> | 14 | * |
17 | #include <errno.h> | 15 | * 1) Added proper error checking. |
18 | #include <utmp.h> | 16 | * 2) Allow '-' arg for stdin. |
17 | * 3) For modern libcs, take into account that utmp char[] members | ||
18 | * need not be nul-terminated. | ||
19 | */ | ||
20 | |||
19 | #include <stdlib.h> | 21 | #include <stdlib.h> |
20 | #include <unistd.h> | 22 | #include <unistd.h> |
21 | #include <time.h> | 23 | #include <fcntl.h> |
24 | #include <utmp.h> | ||
22 | #include "busybox.h" | 25 | #include "busybox.h" |
23 | 26 | ||
27 | /* Grr... utmp char[] members do not have to be nul-terminated. | ||
28 | * Do what we can while still keeping this reasonably small. | ||
29 | * Note: We are assuming the ut_id[] size is fixed at 4. */ | ||
30 | |||
31 | #if __GNU_LIBRARY__ < 5 | ||
32 | #warning the format string needs to be changed | ||
33 | #else | ||
34 | #if (UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256) | ||
35 | #error struct utmp member char[] size(s) have changed! | ||
36 | #endif | ||
37 | #endif | ||
38 | |||
24 | extern int dutmp_main(int argc, char **argv) | 39 | extern int dutmp_main(int argc, char **argv) |
25 | { | 40 | { |
26 | 41 | int file = STDIN_FILENO; | |
27 | int file; | 42 | ssize_t n; |
28 | struct utmp ut; | 43 | struct utmp ut; |
29 | 44 | ||
30 | if (argc<2) { | 45 | if (argc > 2) { |
31 | file = fileno(stdin); | 46 | bb_show_usage(); |
32 | } else if (*argv[1] == '-' ) { | 47 | } |
33 | show_usage(); | 48 | ++argv; |
34 | } else { | 49 | if ((argc == 2) && ((argv[0][0] != '-') || argv[0][1])) { |
35 | file = open(argv[1], O_RDONLY); | 50 | file = bb_xopen(*argv, O_RDONLY); |
36 | if (file < 0) { | ||
37 | error_msg_and_die(io_error, argv[1]); | ||
38 | } | ||
39 | } | 51 | } |
40 | 52 | ||
41 | /* Kludge around the fact that the binary format for utmp has changed. */ | 53 | |
54 | while ((n = safe_read(file, (void*)&ut, sizeof(struct utmp))) != 0) { | ||
55 | |||
56 | if (n != sizeof(struct utmp)) { | ||
57 | bb_perror_msg_and_die("short read"); | ||
58 | } | ||
59 | |||
60 | /* Kludge around the fact that the binary format for utmp has changed. */ | ||
42 | #if __GNU_LIBRARY__ < 5 | 61 | #if __GNU_LIBRARY__ < 5 |
43 | /* Linux libc5 */ | 62 | /* Linux libc5 */ |
44 | while (read(file, (void*)&ut, sizeof(struct utmp))) { | 63 | |
45 | printf("%d|%d|%s|%s|%s|%s|%s|%lx\n", | 64 | bb_printf("%d|%d|%s|%s|%s|%s|%s|%lx\n", |
46 | ut.ut_type, ut.ut_pid, ut.ut_line, | 65 | ut.ut_type, ut.ut_pid, ut.ut_line, |
47 | ut.ut_id, ut.ut_user, ut.ut_host, | 66 | ut.ut_id, ut.ut_user, ut.ut_host, |
48 | ctime(&(ut.ut_time)), | 67 | ctime(&(ut.ut_time)), |
49 | (long)ut.ut_addr); | 68 | (long)ut.ut_addr); |
50 | } | ||
51 | #else | 69 | #else |
52 | /* Glibc, uClibc, etc. */ | 70 | /* Glibc, uClibc, etc. */ |
53 | while (read(file, (void*)&ut, sizeof(struct utmp))) { | 71 | |
54 | printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n", | 72 | bb_printf("%d|%d|%.32s|%.4s|%.32s|%.256s|%d|%d|%ld|%ld|%ld|%x\n", |
55 | ut.ut_type, ut.ut_pid, ut.ut_line, | 73 | ut.ut_type, ut.ut_pid, ut.ut_line, |
56 | ut.ut_id, ut.ut_user, ut.ut_host, | 74 | ut.ut_id, ut.ut_user, ut.ut_host, |
57 | ut.ut_exit.e_termination, ut.ut_exit.e_exit, | 75 | ut.ut_exit.e_termination, ut.ut_exit.e_exit, |
58 | ut.ut_session, | 76 | ut.ut_session, |
59 | ut.ut_tv.tv_sec, ut.ut_tv.tv_usec, | 77 | ut.ut_tv.tv_sec, ut.ut_tv.tv_usec, |
60 | ut.ut_addr); | 78 | ut.ut_addr); |
61 | } | ||
62 | #endif | 79 | #endif |
63 | return EXIT_SUCCESS; | 80 | } |
81 | |||
82 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); | ||
64 | } | 83 | } |
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index 67b28b534..308d651ae 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c | |||
@@ -22,7 +22,7 @@ int makedevs_main(int argc, char **argv) | |||
22 | int major, Sminor, S, E; | 22 | int major, Sminor, S, E; |
23 | 23 | ||
24 | if (argc < 7 || *argv[1]=='-') | 24 | if (argc < 7 || *argv[1]=='-') |
25 | show_usage(); | 25 | bb_show_usage(); |
26 | 26 | ||
27 | basedev = argv[1]; | 27 | basedev = argv[1]; |
28 | type = argv[2]; | 28 | type = argv[2]; |
@@ -45,7 +45,7 @@ int makedevs_main(int argc, char **argv) | |||
45 | mode |= S_IFIFO; | 45 | mode |= S_IFIFO; |
46 | break; | 46 | break; |
47 | default: | 47 | default: |
48 | show_usage(); | 48 | bb_show_usage(); |
49 | } | 49 | } |
50 | 50 | ||
51 | while (S <= E) { | 51 | while (S <= E) { |
@@ -53,12 +53,12 @@ int makedevs_main(int argc, char **argv) | |||
53 | 53 | ||
54 | sz = snprintf(buf, sizeof(buf), "%s%d", basedev, S); | 54 | sz = snprintf(buf, sizeof(buf), "%s%d", basedev, S); |
55 | if(sz<0 || sz>=sizeof(buf)) /* libc different */ | 55 | if(sz<0 || sz>=sizeof(buf)) /* libc different */ |
56 | error_msg_and_die("%s too large", basedev); | 56 | bb_error_msg_and_die("%s too large", basedev); |
57 | 57 | ||
58 | /* if mode != S_IFCHR and != S_IFBLK third param in mknod() ignored */ | 58 | /* if mode != S_IFCHR and != S_IFBLK third param in mknod() ignored */ |
59 | 59 | ||
60 | if (mknod(nodname, mode, major | Sminor)) | 60 | if (mknod(nodname, mode, major | Sminor)) |
61 | error_msg("Failed to create: %s", nodname); | 61 | bb_error_msg("Failed to create: %s", nodname); |
62 | 62 | ||
63 | if (nodname == basedev) /* ex. /dev/hda - to /dev/hda1 ... */ | 63 | if (nodname == basedev) /* ex. /dev/hda - to /dev/hda1 ... */ |
64 | nodname = buf; | 64 | nodname = buf; |
diff --git a/miscutils/mt.c b/miscutils/mt.c index 49dc70ac6..e79954552 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c | |||
@@ -59,12 +59,12 @@ extern int mt_main(int argc, char **argv) | |||
59 | int fd, mode; | 59 | int fd, mode; |
60 | 60 | ||
61 | if (argc < 2) { | 61 | if (argc < 2) { |
62 | show_usage(); | 62 | bb_show_usage(); |
63 | } | 63 | } |
64 | 64 | ||
65 | if (strcmp(argv[1], "-f") == 0) { | 65 | if (strcmp(argv[1], "-f") == 0) { |
66 | if (argc < 4) { | 66 | if (argc < 4) { |
67 | show_usage(); | 67 | bb_show_usage(); |
68 | } | 68 | } |
69 | file = argv[2]; | 69 | file = argv[2]; |
70 | argv += 2; | 70 | argv += 2; |
@@ -78,7 +78,7 @@ extern int mt_main(int argc, char **argv) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | if (code->name == 0) { | 80 | if (code->name == 0) { |
81 | error_msg("unrecognized opcode %s.", argv[1]); | 81 | bb_error_msg("unrecognized opcode %s.", argv[1]); |
82 | return EXIT_FAILURE; | 82 | return EXIT_FAILURE; |
83 | } | 83 | } |
84 | 84 | ||
@@ -102,18 +102,18 @@ extern int mt_main(int argc, char **argv) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | if ((fd = open(file, mode, 0)) < 0) | 104 | if ((fd = open(file, mode, 0)) < 0) |
105 | perror_msg_and_die("%s", file); | 105 | bb_perror_msg_and_die("%s", file); |
106 | 106 | ||
107 | switch (code->value) { | 107 | switch (code->value) { |
108 | case MTTELL: | 108 | case MTTELL: |
109 | if (ioctl(fd, MTIOCPOS, &position) < 0) | 109 | if (ioctl(fd, MTIOCPOS, &position) < 0) |
110 | perror_msg_and_die("%s", file); | 110 | bb_perror_msg_and_die("%s", file); |
111 | printf ("At block %d.\n", (int) position.mt_blkno); | 111 | printf ("At block %d.\n", (int) position.mt_blkno); |
112 | break; | 112 | break; |
113 | 113 | ||
114 | default: | 114 | default: |
115 | if (ioctl(fd, MTIOCTOP, &op) != 0) | 115 | if (ioctl(fd, MTIOCTOP, &op) != 0) |
116 | perror_msg_and_die("%s", file); | 116 | bb_perror_msg_and_die("%s", file); |
117 | break; | 117 | break; |
118 | } | 118 | } |
119 | 119 | ||
diff --git a/miscutils/strings.c b/miscutils/strings.c index 8d08b3f23..2413c3f2d 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c | |||
@@ -57,7 +57,7 @@ int strings_main(int argc, char **argv) | |||
57 | n = bb_xgetlarg(optarg, 10, 1, LONG_MAX); | 57 | n = bb_xgetlarg(optarg, 10, 1, LONG_MAX); |
58 | break; | 58 | break; |
59 | default: | 59 | default: |
60 | show_usage(); | 60 | bb_show_usage(); |
61 | } | 61 | } |
62 | 62 | ||
63 | argc -= optind; | 63 | argc -= optind; |
@@ -118,7 +118,7 @@ pipe: | |||
118 | } | 118 | } |
119 | else | 119 | else |
120 | { | 120 | { |
121 | perror_msg("%s",argv[a]); | 121 | bb_perror_msg("%s",argv[a]); |
122 | status=EXIT_FAILURE; | 122 | status=EXIT_FAILURE; |
123 | } | 123 | } |
124 | } | 124 | } |
diff --git a/miscutils/time.c b/miscutils/time.c index fa352a899..c30ef4311 100644 --- a/miscutils/time.c +++ b/miscutils/time.c | |||
@@ -141,7 +141,7 @@ static void fprintargv (FILE *fp, char *const *argv, const char *filler) | |||
141 | fputs (*av, fp); | 141 | fputs (*av, fp); |
142 | } | 142 | } |
143 | if (ferror (fp)) | 143 | if (ferror (fp)) |
144 | error_msg_and_die("write error"); | 144 | bb_error_msg_and_die("write error"); |
145 | } | 145 | } |
146 | 146 | ||
147 | /* Return the number of kilobytes corresponding to a number of pages PAGES. | 147 | /* Return the number of kilobytes corresponding to a number of pages PAGES. |
@@ -416,12 +416,12 @@ static void summarize (FILE *fp, const char *fmt, char **command, resource_t *re | |||
416 | } | 416 | } |
417 | 417 | ||
418 | if (ferror (fp)) | 418 | if (ferror (fp)) |
419 | error_msg_and_die("write error"); | 419 | bb_error_msg_and_die("write error"); |
420 | } | 420 | } |
421 | putc ('\n', fp); | 421 | putc ('\n', fp); |
422 | 422 | ||
423 | if (ferror (fp)) | 423 | if (ferror (fp)) |
424 | error_msg_and_die("write error"); | 424 | bb_error_msg_and_die("write error"); |
425 | } | 425 | } |
426 | 426 | ||
427 | /* Run command CMD and return statistics on it. | 427 | /* Run command CMD and return statistics on it. |
@@ -434,13 +434,13 @@ static void run_command (char *const *cmd, resource_t *resp) | |||
434 | gettimeofday (&resp->start, (struct timezone *) 0); | 434 | gettimeofday (&resp->start, (struct timezone *) 0); |
435 | pid = fork (); /* Run CMD as child process. */ | 435 | pid = fork (); /* Run CMD as child process. */ |
436 | if (pid < 0) | 436 | if (pid < 0) |
437 | error_msg_and_die("cannot fork"); | 437 | bb_error_msg_and_die("cannot fork"); |
438 | else if (pid == 0) | 438 | else if (pid == 0) |
439 | { /* If child. */ | 439 | { /* If child. */ |
440 | /* Don't cast execvp arguments; that causes errors on some systems, | 440 | /* Don't cast execvp arguments; that causes errors on some systems, |
441 | versus merely warnings if the cast is left off. */ | 441 | versus merely warnings if the cast is left off. */ |
442 | execvp (cmd[0], cmd); | 442 | execvp (cmd[0], cmd); |
443 | error_msg("cannot run %s", cmd[0]); | 443 | bb_error_msg("cannot run %s", cmd[0]); |
444 | _exit (errno == ENOENT ? 127 : 126); | 444 | _exit (errno == ENOENT ? 127 : 126); |
445 | } | 445 | } |
446 | 446 | ||
@@ -449,7 +449,7 @@ static void run_command (char *const *cmd, resource_t *resp) | |||
449 | quit_signal = signal (SIGQUIT, SIG_IGN); | 449 | quit_signal = signal (SIGQUIT, SIG_IGN); |
450 | 450 | ||
451 | if (resuse_end (pid, resp) == 0) | 451 | if (resuse_end (pid, resp) == 0) |
452 | error_msg("error waiting for child process"); | 452 | bb_error_msg("error waiting for child process"); |
453 | 453 | ||
454 | /* Re-enable signals. */ | 454 | /* Re-enable signals. */ |
455 | signal (SIGINT, interrupt_signal); | 455 | signal (SIGINT, interrupt_signal); |
@@ -477,7 +477,7 @@ extern int time_main (int argc, char **argv) | |||
477 | output_format = posix_format; | 477 | output_format = posix_format; |
478 | break; | 478 | break; |
479 | default: | 479 | default: |
480 | show_usage(); | 480 | bb_show_usage(); |
481 | } | 481 | } |
482 | argc--; | 482 | argc--; |
483 | argv++; | 483 | argv++; |
@@ -486,7 +486,7 @@ extern int time_main (int argc, char **argv) | |||
486 | } | 486 | } |
487 | 487 | ||
488 | if (argv == NULL || *argv == NULL) | 488 | if (argv == NULL || *argv == NULL) |
489 | show_usage(); | 489 | bb_show_usage(); |
490 | 490 | ||
491 | run_command (argv, &res); | 491 | run_command (argv, &res); |
492 | summarize (stdout, output_format, argv, &res); | 492 | summarize (stdout, output_format, argv, &res); |
diff --git a/miscutils/update.c b/miscutils/update.c index 27a04ddee..48ea02deb 100644 --- a/miscutils/update.c +++ b/miscutils/update.c | |||
@@ -62,12 +62,12 @@ extern int update_main(int argc, char **argv) | |||
62 | flush_duration = atoi(optarg); | 62 | flush_duration = atoi(optarg); |
63 | break; | 63 | break; |
64 | default: | 64 | default: |
65 | show_usage(); | 65 | bb_show_usage(); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | if (daemon(0, 1) < 0) | 69 | if (daemon(0, 1) < 0) |
70 | perror_msg_and_die("daemon"); | 70 | bb_perror_msg_and_die("daemon"); |
71 | 71 | ||
72 | #ifdef OPEN_MAX | 72 | #ifdef OPEN_MAX |
73 | for (pid = 0; pid < OPEN_MAX; pid++) close(pid); | 73 | for (pid = 0; pid < OPEN_MAX; pid++) close(pid); |
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index f0b0ebd0e..cfe19abc3 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c | |||
@@ -33,11 +33,11 @@ extern int watchdog_main(int argc, char **argv) | |||
33 | int fd; | 33 | int fd; |
34 | 34 | ||
35 | if (argc != 2) { | 35 | if (argc != 2) { |
36 | show_usage(); | 36 | bb_show_usage(); |
37 | } | 37 | } |
38 | 38 | ||
39 | if ((fd=open(argv[1], O_WRONLY)) == -1) { | 39 | if ((fd=open(argv[1], O_WRONLY)) == -1) { |
40 | perror_msg_and_die(argv[1]); | 40 | bb_perror_msg_and_die(argv[1]); |
41 | } | 41 | } |
42 | 42 | ||
43 | while (1) { | 43 | while (1) { |