diff options
author | Ron Yorston <rmy@pobox.com> | 2019-08-16 09:42:39 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-08-16 09:45:21 +0100 |
commit | 517cf74f6265ec4308b790b637b3f9778cbdc6e0 (patch) | |
tree | be9337069b60ca1bb03565d8575bacfc71181003 /coreutils | |
parent | ae65dc37bcc9b1d9cef0b111131c79dc4ba1bf51 (diff) | |
parent | ac78f2ac96b3efd6551a08e7dc609efa1fb69481 (diff) | |
download | busybox-w32-517cf74f6265ec4308b790b637b3f9778cbdc6e0.tar.gz busybox-w32-517cf74f6265ec4308b790b637b3f9778cbdc6e0.tar.bz2 busybox-w32-517cf74f6265ec4308b790b637b3f9778cbdc6e0.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cp.c | 4 | ||||
-rw-r--r-- | coreutils/cut.c | 6 | ||||
-rw-r--r-- | coreutils/date.c | 2 | ||||
-rw-r--r-- | coreutils/df.c | 2 | ||||
-rw-r--r-- | coreutils/echo.c | 2 | ||||
-rw-r--r-- | coreutils/env.c | 2 | ||||
-rw-r--r-- | coreutils/expand.c | 47 | ||||
-rw-r--r-- | coreutils/expr.c | 16 | ||||
-rw-r--r-- | coreutils/id.c | 2 | ||||
-rw-r--r-- | coreutils/install.c | 2 | ||||
-rw-r--r-- | coreutils/ln.c | 2 | ||||
-rw-r--r-- | coreutils/logname.c | 2 | ||||
-rw-r--r-- | coreutils/md5_sha1_sum.c | 2 | ||||
-rw-r--r-- | coreutils/od_bloaty.c | 12 | ||||
-rw-r--r-- | coreutils/paste.c | 2 | ||||
-rw-r--r-- | coreutils/printf.c | 2 | ||||
-rw-r--r-- | coreutils/rm.c | 2 | ||||
-rw-r--r-- | coreutils/sort.c | 12 | ||||
-rw-r--r-- | coreutils/split.c | 4 | ||||
-rw-r--r-- | coreutils/stat.c | 75 | ||||
-rw-r--r-- | coreutils/stty.c | 6 | ||||
-rw-r--r-- | coreutils/tail.c | 4 | ||||
-rw-r--r-- | coreutils/test.c | 4 | ||||
-rw-r--r-- | coreutils/tr.c | 4 | ||||
-rw-r--r-- | coreutils/uudecode.c | 8 | ||||
-rw-r--r-- | coreutils/uuencode.c | 2 |
26 files changed, 127 insertions, 101 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 59e3d2f80..cfeb19fc4 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
@@ -217,7 +217,7 @@ int cp_main(int argc, char **argv) | |||
217 | // flags, FILEUTILS_RMDEST, OPT_parents); | 217 | // flags, FILEUTILS_RMDEST, OPT_parents); |
218 | if (flags & OPT_parents) { | 218 | if (flags & OPT_parents) { |
219 | if (!(d_flags & 2)) { | 219 | if (!(d_flags & 2)) { |
220 | bb_error_msg_and_die("with --parents, the destination must be a directory"); | 220 | bb_simple_error_msg_and_die("with --parents, the destination must be a directory"); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | if (flags & FILEUTILS_RMDEST) { | 223 | if (flags & FILEUTILS_RMDEST) { |
@@ -236,7 +236,7 @@ int cp_main(int argc, char **argv) | |||
236 | goto DO_COPY; /* NB: argc==2 -> *++argv==last */ | 236 | goto DO_COPY; /* NB: argc==2 -> *++argv==last */ |
237 | } | 237 | } |
238 | } else if (flags & FILEUTILS_NO_TARGET_DIR) { | 238 | } else if (flags & FILEUTILS_NO_TARGET_DIR) { |
239 | bb_error_msg_and_die("too many arguments"); | 239 | bb_simple_error_msg_and_die("too many arguments"); |
240 | } | 240 | } |
241 | 241 | ||
242 | while (1) { | 242 | while (1) { |
diff --git a/coreutils/cut.c b/coreutils/cut.c index e952dc17b..1acbb513e 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -209,11 +209,11 @@ int cut_main(int argc UNUSED_PARAM, char **argv) | |||
209 | // argc -= optind; | 209 | // argc -= optind; |
210 | argv += optind; | 210 | argv += optind; |
211 | if (!(opt & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) | 211 | if (!(opt & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) |
212 | bb_error_msg_and_die("expected a list of bytes, characters, or fields"); | 212 | bb_simple_error_msg_and_die("expected a list of bytes, characters, or fields"); |
213 | 213 | ||
214 | if (opt & CUT_OPT_DELIM_FLGS) { | 214 | if (opt & CUT_OPT_DELIM_FLGS) { |
215 | if (ltok[0] && ltok[1]) { /* more than 1 char? */ | 215 | if (ltok[0] && ltok[1]) { /* more than 1 char? */ |
216 | bb_error_msg_and_die("the delimiter must be a single character"); | 216 | bb_simple_error_msg_and_die("the delimiter must be a single character"); |
217 | } | 217 | } |
218 | delim = ltok[0]; | 218 | delim = ltok[0]; |
219 | } | 219 | } |
@@ -288,7 +288,7 @@ int cut_main(int argc UNUSED_PARAM, char **argv) | |||
288 | 288 | ||
289 | /* make sure we got some cut positions out of all that */ | 289 | /* make sure we got some cut positions out of all that */ |
290 | if (nlists == 0) | 290 | if (nlists == 0) |
291 | bb_error_msg_and_die("missing list of positions"); | 291 | bb_simple_error_msg_and_die("missing list of positions"); |
292 | 292 | ||
293 | /* now that the lists are parsed, we need to sort them to make life | 293 | /* now that the lists are parsed, we need to sort them to make life |
294 | * easier on us when it comes time to print the chars / fields / lines | 294 | * easier on us when it comes time to print the chars / fields / lines |
diff --git a/coreutils/date.c b/coreutils/date.c index 3414d38ae..feb400430 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -304,7 +304,7 @@ int date_main(int argc UNUSED_PARAM, char **argv) | |||
304 | 304 | ||
305 | /* if setting time, set it */ | 305 | /* if setting time, set it */ |
306 | if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { | 306 | if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { |
307 | bb_perror_msg("can't set date"); | 307 | bb_simple_perror_msg("can't set date"); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
diff --git a/coreutils/df.c b/coreutils/df.c index f6d66e4b6..debb86867 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -178,7 +178,7 @@ int df_main(int argc UNUSED_PARAM, char **argv) | |||
178 | if (!argv[0]) { | 178 | if (!argv[0]) { |
179 | mount_table = setmntent(bb_path_mtab_file, "r"); | 179 | mount_table = setmntent(bb_path_mtab_file, "r"); |
180 | if (!mount_table) | 180 | if (!mount_table) |
181 | bb_perror_msg_and_die(bb_path_mtab_file); | 181 | bb_simple_perror_msg_and_die(bb_path_mtab_file); |
182 | } | 182 | } |
183 | 183 | ||
184 | while (1) { | 184 | while (1) { |
diff --git a/coreutils/echo.c b/coreutils/echo.c index 5dc5be072..b3828894c 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c | |||
@@ -188,7 +188,7 @@ int echo_main(int argc UNUSED_PARAM, char **argv) | |||
188 | /*r =*/ full_write(STDOUT_FILENO, buffer, out - buffer); | 188 | /*r =*/ full_write(STDOUT_FILENO, buffer, out - buffer); |
189 | free(buffer); | 189 | free(buffer); |
190 | if (/*WRONG:r < 0*/ errno) { | 190 | if (/*WRONG:r < 0*/ errno) { |
191 | bb_perror_msg(bb_msg_write_error); | 191 | bb_simple_perror_msg(bb_msg_write_error); |
192 | return 1; | 192 | return 1; |
193 | } | 193 | } |
194 | return 0; | 194 | return 0; |
diff --git a/coreutils/env.c b/coreutils/env.c index 878068f09..c37c0c2df 100644 --- a/coreutils/env.c +++ b/coreutils/env.c | |||
@@ -79,7 +79,7 @@ int env_main(int argc UNUSED_PARAM, char **argv) | |||
79 | 79 | ||
80 | while (*argv && (strchr(*argv, '=') != NULL)) { | 80 | while (*argv && (strchr(*argv, '=') != NULL)) { |
81 | if (putenv(*argv) < 0) { | 81 | if (putenv(*argv) < 0) { |
82 | bb_perror_msg_and_die("putenv"); | 82 | bb_simple_perror_msg_and_die("putenv"); |
83 | } | 83 | } |
84 | ++argv; | 84 | ++argv; |
85 | } | 85 | } |
diff --git a/coreutils/expand.c b/coreutils/expand.c index f7e4619f9..4fa974df8 100644 --- a/coreutils/expand.c +++ b/coreutils/expand.c | |||
@@ -63,33 +63,62 @@ enum { | |||
63 | OPT_ALL = 1 << 2, | 63 | OPT_ALL = 1 << 2, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | //FIXME: does not work properly with input containing NULs | ||
67 | //coreutils 8.30 preserves NULs but treats them as chars of width zero: | ||
68 | //AB<nul><tab>C will expand <tab> to 6 spaces, not 5. | ||
69 | |||
66 | #if ENABLE_EXPAND | 70 | #if ENABLE_EXPAND |
67 | static void expand(FILE *file, unsigned tab_size, unsigned opt) | 71 | static void expand(FILE *file, unsigned tab_size, unsigned opt) |
68 | { | 72 | { |
69 | char *line; | ||
70 | 73 | ||
71 | while ((line = xmalloc_fgets(file)) != NULL) { | 74 | for (;;) { |
72 | unsigned char c; | 75 | char *line; |
73 | char *ptr; | 76 | char *ptr; |
74 | char *ptr_strbeg; | 77 | char *ptr_strbeg; |
75 | 78 | //commented-out code handles NULs, +90 bytes of code, not tested much | |
79 | // size_t linelen; | ||
80 | // unsigned len = 0; | ||
81 | |||
82 | // linelen = 1024 * 1024; | ||
83 | // line = xmalloc_fgets_str_len(file, "\n", &linelen); | ||
84 | line = xmalloc_fgets(file); // | ||
85 | if (!line) | ||
86 | break; | ||
76 | ptr = ptr_strbeg = line; | 87 | ptr = ptr_strbeg = line; |
77 | while ((c = *ptr) != '\0') { | 88 | for (;;) { |
89 | unsigned char c = *ptr; | ||
90 | if (c == '\0') { | ||
91 | // size_t rem = line + linelen - ptr; | ||
92 | // if (rem > 0) { | ||
93 | //# if ENABLE_UNICODE_SUPPORT | ||
94 | // len += unicode_strwidth(ptr_strbeg); | ||
95 | //# else | ||
96 | // len += ptr - ptr_strbeg; | ||
97 | //# endif | ||
98 | // printf("%s%c", ptr_strbeg, '\0'); | ||
99 | // memmove(ptr, ptr + 1, rem + 1); | ||
100 | // ptr_strbeg = ptr; | ||
101 | // linelen--; | ||
102 | // continue; | ||
103 | // } | ||
104 | break; | ||
105 | } | ||
78 | if ((opt & OPT_INITIAL) && !isblank(c)) { | 106 | if ((opt & OPT_INITIAL) && !isblank(c)) { |
79 | /* not space or tab */ | 107 | /* not space or tab */ |
80 | break; | 108 | break; |
81 | } | 109 | } |
82 | if (c == '\t') { | 110 | if (c == '\t') { |
83 | unsigned len; | 111 | unsigned len = 0; // |
84 | *ptr = '\0'; | 112 | *ptr = '\0'; |
85 | # if ENABLE_UNICODE_SUPPORT | 113 | # if ENABLE_UNICODE_SUPPORT |
86 | len = unicode_strwidth(ptr_strbeg); | 114 | len += unicode_strwidth(ptr_strbeg); |
87 | # else | 115 | # else |
88 | len = ptr - ptr_strbeg; | 116 | len += ptr - ptr_strbeg; |
89 | # endif | 117 | # endif |
90 | len = tab_size - (len % tab_size); | 118 | len = tab_size - (len % tab_size); |
91 | /*while (ptr[1] == '\t') { ptr++; len += tab_size; } - can handle many tabs at once */ | 119 | /*while (ptr[1] == '\t') { ptr++; len += tab_size; } - can handle many tabs at once */ |
92 | printf("%s%*s", ptr_strbeg, len, ""); | 120 | printf("%s%*s", ptr_strbeg, len, ""); |
121 | // len = 0; | ||
93 | ptr_strbeg = ptr + 1; | 122 | ptr_strbeg = ptr + 1; |
94 | } | 123 | } |
95 | ptr++; | 124 | ptr++; |
@@ -218,7 +247,7 @@ int expand_main(int argc UNUSED_PARAM, char **argv) | |||
218 | /* Now close stdin also */ | 247 | /* Now close stdin also */ |
219 | /* (if we didn't read from it, it's a no-op) */ | 248 | /* (if we didn't read from it, it's a no-op) */ |
220 | if (fclose(stdin)) | 249 | if (fclose(stdin)) |
221 | bb_perror_msg_and_die(bb_msg_standard_input); | 250 | bb_simple_perror_msg_and_die(bb_msg_standard_input); |
222 | 251 | ||
223 | fflush_stdout_and_exit(exit_status); | 252 | fflush_stdout_and_exit(exit_status); |
224 | } | 253 | } |
diff --git a/coreutils/expr.c b/coreutils/expr.c index 900248103..c11505d13 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -249,7 +249,7 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op) | |||
249 | arith_t li, ri; | 249 | arith_t li, ri; |
250 | 250 | ||
251 | if (!toarith(l) || !toarith(r)) | 251 | if (!toarith(l) || !toarith(r)) |
252 | bb_error_msg_and_die("non-numeric argument"); | 252 | bb_simple_error_msg_and_die("non-numeric argument"); |
253 | li = l->u.i; | 253 | li = l->u.i; |
254 | ri = r->u.i; | 254 | ri = r->u.i; |
255 | if (op == '+') | 255 | if (op == '+') |
@@ -259,7 +259,7 @@ static arith_t arithmetic_common(VALUE *l, VALUE *r, int op) | |||
259 | if (op == '*') | 259 | if (op == '*') |
260 | return li * ri; | 260 | return li * ri; |
261 | if (ri == 0) | 261 | if (ri == 0) |
262 | bb_error_msg_and_die("division by zero"); | 262 | bb_simple_error_msg_and_die("division by zero"); |
263 | if (op == '/') | 263 | if (op == '/') |
264 | return li / ri; | 264 | return li / ri; |
265 | return li % ri; | 265 | return li % ri; |
@@ -319,19 +319,19 @@ static VALUE *eval7(void) | |||
319 | VALUE *v; | 319 | VALUE *v; |
320 | 320 | ||
321 | if (!*G.args) | 321 | if (!*G.args) |
322 | bb_error_msg_and_die("syntax error"); | 322 | bb_simple_error_msg_and_die("syntax error"); |
323 | 323 | ||
324 | if (nextarg("(")) { | 324 | if (nextarg("(")) { |
325 | G.args++; | 325 | G.args++; |
326 | v = eval(); | 326 | v = eval(); |
327 | if (!nextarg(")")) | 327 | if (!nextarg(")")) |
328 | bb_error_msg_and_die("syntax error"); | 328 | bb_simple_error_msg_and_die("syntax error"); |
329 | G.args++; | 329 | G.args++; |
330 | return v; | 330 | return v; |
331 | } | 331 | } |
332 | 332 | ||
333 | if (nextarg(")")) | 333 | if (nextarg(")")) |
334 | bb_error_msg_and_die("syntax error"); | 334 | bb_simple_error_msg_and_die("syntax error"); |
335 | 335 | ||
336 | return str_value(*G.args++); | 336 | return str_value(*G.args++); |
337 | } | 337 | } |
@@ -353,7 +353,7 @@ static VALUE *eval6(void) | |||
353 | G.args++; /* We have a valid token, so get the next argument. */ | 353 | G.args++; /* We have a valid token, so get the next argument. */ |
354 | if (key == 1) { /* quote */ | 354 | if (key == 1) { /* quote */ |
355 | if (!*G.args) | 355 | if (!*G.args) |
356 | bb_error_msg_and_die("syntax error"); | 356 | bb_simple_error_msg_and_die("syntax error"); |
357 | return str_value(*G.args++); | 357 | return str_value(*G.args++); |
358 | } | 358 | } |
359 | if (key == 2) { /* length */ | 359 | if (key == 2) { /* length */ |
@@ -546,11 +546,11 @@ int expr_main(int argc UNUSED_PARAM, char **argv) | |||
546 | xfunc_error_retval = 2; /* coreutils compat */ | 546 | xfunc_error_retval = 2; /* coreutils compat */ |
547 | G.args = argv + 1; | 547 | G.args = argv + 1; |
548 | if (*G.args == NULL) { | 548 | if (*G.args == NULL) { |
549 | bb_error_msg_and_die("too few arguments"); | 549 | bb_simple_error_msg_and_die("too few arguments"); |
550 | } | 550 | } |
551 | v = eval(); | 551 | v = eval(); |
552 | if (*G.args) | 552 | if (*G.args) |
553 | bb_error_msg_and_die("syntax error"); | 553 | bb_simple_error_msg_and_die("syntax error"); |
554 | if (v->type == INTEGER) | 554 | if (v->type == INTEGER) |
555 | printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i); | 555 | printf("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i); |
556 | else | 556 | else |
diff --git a/coreutils/id.c b/coreutils/id.c index 00c0cd8ab..f20cd7d09 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -231,7 +231,7 @@ int id_main(int argc UNUSED_PARAM, char **argv) | |||
231 | } | 231 | } |
232 | } else if (n < 0) { /* error in get_groups() */ | 232 | } else if (n < 0) { /* error in get_groups() */ |
233 | if (ENABLE_DESKTOP) | 233 | if (ENABLE_DESKTOP) |
234 | bb_error_msg_and_die("can't get groups"); | 234 | bb_simple_error_msg_and_die("can't get groups"); |
235 | return EXIT_FAILURE; | 235 | return EXIT_FAILURE; |
236 | } | 236 | } |
237 | if (ENABLE_FEATURE_CLEAN_UP) | 237 | if (ENABLE_FEATURE_CLEAN_UP) |
diff --git a/coreutils/install.c b/coreutils/install.c index 8270490bd..c0f1c538a 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -238,7 +238,7 @@ int install_main(int argc, char **argv) | |||
238 | args[2] = dest; | 238 | args[2] = dest; |
239 | args[3] = NULL; | 239 | args[3] = NULL; |
240 | if (spawn_and_wait(args)) { | 240 | if (spawn_and_wait(args)) { |
241 | bb_perror_msg("strip"); | 241 | bb_simple_perror_msg("strip"); |
242 | ret = EXIT_FAILURE; | 242 | ret = EXIT_FAILURE; |
243 | } | 243 | } |
244 | } | 244 | } |
diff --git a/coreutils/ln.c b/coreutils/ln.c index afeb0d72d..ea2d10eab 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -69,7 +69,7 @@ int ln_main(int argc, char **argv) | |||
69 | argc -= optind; | 69 | argc -= optind; |
70 | 70 | ||
71 | if ((opts & LN_LINKFILE) && argc > 2) { | 71 | if ((opts & LN_LINKFILE) && argc > 2) { |
72 | bb_error_msg_and_die("-T accepts 2 args max"); | 72 | bb_simple_error_msg_and_die("-T accepts 2 args max"); |
73 | } | 73 | } |
74 | 74 | ||
75 | if (!argv[1]) { | 75 | if (!argv[1]) { |
diff --git a/coreutils/logname.c b/coreutils/logname.c index 31ce61f0c..06bbe1b0e 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c | |||
@@ -56,5 +56,5 @@ int logname_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
56 | return fflush_all(); | 56 | return fflush_all(); |
57 | } | 57 | } |
58 | 58 | ||
59 | bb_perror_msg_and_die("getlogin"); | 59 | bb_simple_perror_msg_and_die("getlogin"); |
60 | } | 60 | } |
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 538df251b..ba26c985a 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -300,7 +300,7 @@ int md5_sha1_sum_main(int argc UNUSED_PARAM, char **argv) | |||
300 | } | 300 | } |
301 | if (filename_ptr == NULL) { | 301 | if (filename_ptr == NULL) { |
302 | if (flags & FLAG_WARN) { | 302 | if (flags & FLAG_WARN) { |
303 | bb_error_msg("invalid format"); | 303 | bb_simple_error_msg("invalid format"); |
304 | } | 304 | } |
305 | count_failed++; | 305 | count_failed++; |
306 | return_value = EXIT_FAILURE; | 306 | return_value = EXIT_FAILURE; |
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index 75e14ef7d..ea1ab9de8 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -543,7 +543,7 @@ check_and_close(void) | |||
543 | } | 543 | } |
544 | 544 | ||
545 | if (ferror(stdout)) { | 545 | if (ferror(stdout)) { |
546 | bb_error_msg_and_die(bb_msg_write_error); | 546 | bb_simple_error_msg_and_die(bb_msg_write_error); |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
@@ -848,7 +848,7 @@ skip(off_t n_skip) | |||
848 | } | 848 | } |
849 | 849 | ||
850 | if (n_skip) | 850 | if (n_skip) |
851 | bb_error_msg_and_die("can't skip past end of combined input"); | 851 | bb_simple_error_msg_and_die("can't skip past end of combined input"); |
852 | } | 852 | } |
853 | 853 | ||
854 | 854 | ||
@@ -1315,10 +1315,10 @@ int od_main(int argc UNUSED_PARAM, char **argv) | |||
1315 | pseudo_start = o2; | 1315 | pseudo_start = o2; |
1316 | argv[1] = NULL; | 1316 | argv[1] = NULL; |
1317 | } else { | 1317 | } else { |
1318 | bb_error_msg_and_die("the last two arguments must be offsets"); | 1318 | bb_simple_error_msg_and_die("the last two arguments must be offsets"); |
1319 | } | 1319 | } |
1320 | } else { /* >3 args */ | 1320 | } else { /* >3 args */ |
1321 | bb_error_msg_and_die("too many arguments"); | 1321 | bb_simple_error_msg_and_die("too many arguments"); |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | if (pseudo_start >= 0) { | 1324 | if (pseudo_start >= 0) { |
@@ -1339,7 +1339,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) | |||
1339 | if (option_mask32 & OPT_N) { | 1339 | if (option_mask32 & OPT_N) { |
1340 | end_offset = n_bytes_to_skip + max_bytes_to_format; | 1340 | end_offset = n_bytes_to_skip + max_bytes_to_format; |
1341 | if (end_offset < n_bytes_to_skip) | 1341 | if (end_offset < n_bytes_to_skip) |
1342 | bb_error_msg_and_die("SKIP + SIZE is too large"); | 1342 | bb_simple_error_msg_and_die("SKIP + SIZE is too large"); |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | if (G.n_specs == 0) { | 1345 | if (G.n_specs == 0) { |
@@ -1396,7 +1396,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) | |||
1396 | dump(n_bytes_to_skip, end_offset); | 1396 | dump(n_bytes_to_skip, end_offset); |
1397 | 1397 | ||
1398 | if (fclose(stdin)) | 1398 | if (fclose(stdin)) |
1399 | bb_perror_msg_and_die(bb_msg_standard_input); | 1399 | bb_simple_perror_msg_and_die(bb_msg_standard_input); |
1400 | 1400 | ||
1401 | return G.exit_code; | 1401 | return G.exit_code; |
1402 | } | 1402 | } |
diff --git a/coreutils/paste.c b/coreutils/paste.c index 3d81a5f1a..11743297a 100644 --- a/coreutils/paste.c +++ b/coreutils/paste.c | |||
@@ -116,7 +116,7 @@ int paste_main(int argc UNUSED_PARAM, char **argv) | |||
116 | 116 | ||
117 | if (opt & PASTE_OPT_DELIMITERS) { | 117 | if (opt & PASTE_OPT_DELIMITERS) { |
118 | if (!delims[0]) | 118 | if (!delims[0]) |
119 | bb_error_msg_and_die("-d '' is not supported"); | 119 | bb_simple_error_msg_and_die("-d '' is not supported"); |
120 | /* unknown mappings are not changed: "\z" -> '\\' 'z' */ | 120 | /* unknown mappings are not changed: "\z" -> '\\' 'z' */ |
121 | /* trailing backslash, if any, is preserved */ | 121 | /* trailing backslash, if any, is preserved */ |
122 | del_cnt = strcpy_and_process_escape_sequences(delims, delims) - delims; | 122 | del_cnt = strcpy_and_process_escape_sequences(delims, delims) - delims; |
diff --git a/coreutils/printf.c b/coreutils/printf.c index 5cf518699..a20fc3301 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c | |||
@@ -430,7 +430,7 @@ int printf_main(int argc UNUSED_PARAM, char **argv) | |||
430 | if (ENABLE_ASH_PRINTF | 430 | if (ENABLE_ASH_PRINTF |
431 | && applet_name[0] != 'p' | 431 | && applet_name[0] != 'p' |
432 | ) { | 432 | ) { |
433 | bb_error_msg("usage: printf FORMAT [ARGUMENT...]"); | 433 | bb_simple_error_msg("usage: printf FORMAT [ARGUMENT...]"); |
434 | return 2; /* bash compat */ | 434 | return 2; /* bash compat */ |
435 | } | 435 | } |
436 | bb_show_usage(); | 436 | bb_show_usage(); |
diff --git a/coreutils/rm.c b/coreutils/rm.c index fd94bb5c4..d000129d9 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -62,7 +62,7 @@ int rm_main(int argc UNUSED_PARAM, char **argv) | |||
62 | const char *base = bb_get_last_path_component_strip(*argv); | 62 | const char *base = bb_get_last_path_component_strip(*argv); |
63 | 63 | ||
64 | if (DOT_OR_DOTDOT(base)) { | 64 | if (DOT_OR_DOTDOT(base)) { |
65 | bb_error_msg("can't remove '.' or '..'"); | 65 | bb_simple_error_msg("can't remove '.' or '..'"); |
66 | } else if (remove_file(*argv, flags) >= 0) { | 66 | } else if (remove_file(*argv, flags) >= 0) { |
67 | continue; | 67 | continue; |
68 | } | 68 | } |
diff --git a/coreutils/sort.c b/coreutils/sort.c index f04c6067b..07c327645 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -277,7 +277,7 @@ static int compare_keys(const void *xarg, const void *yarg) | |||
277 | /* Perform actual comparison */ | 277 | /* Perform actual comparison */ |
278 | switch (flags & (FLAG_n | FLAG_g | FLAG_M | FLAG_V)) { | 278 | switch (flags & (FLAG_n | FLAG_g | FLAG_M | FLAG_V)) { |
279 | default: | 279 | default: |
280 | bb_error_msg_and_die("unknown sort type"); | 280 | bb_simple_error_msg_and_die("unknown sort type"); |
281 | break; | 281 | break; |
282 | #if defined(HAVE_STRVERSCMP) && HAVE_STRVERSCMP == 1 | 282 | #if defined(HAVE_STRVERSCMP) && HAVE_STRVERSCMP == 1 |
283 | case FLAG_V: | 283 | case FLAG_V: |
@@ -398,10 +398,10 @@ static unsigned str2u(char **str) | |||
398 | { | 398 | { |
399 | unsigned long lu; | 399 | unsigned long lu; |
400 | if (!isdigit((*str)[0])) | 400 | if (!isdigit((*str)[0])) |
401 | bb_error_msg_and_die("bad field specification"); | 401 | bb_simple_error_msg_and_die("bad field specification"); |
402 | lu = strtoul(*str, str, 10); | 402 | lu = strtoul(*str, str, 10); |
403 | if ((sizeof(long) > sizeof(int) && lu > INT_MAX) || !lu) | 403 | if ((sizeof(long) > sizeof(int) && lu > INT_MAX) || !lu) |
404 | bb_error_msg_and_die("bad field specification"); | 404 | bb_simple_error_msg_and_die("bad field specification"); |
405 | return lu; | 405 | return lu; |
406 | } | 406 | } |
407 | #endif | 407 | #endif |
@@ -461,7 +461,7 @@ int sort_main(int argc UNUSED_PARAM, char **argv) | |||
461 | #if ENABLE_FEATURE_SORT_BIG | 461 | #if ENABLE_FEATURE_SORT_BIG |
462 | if (opts & FLAG_t) { | 462 | if (opts & FLAG_t) { |
463 | if (!str_t[0] || str_t[1]) | 463 | if (!str_t[0] || str_t[1]) |
464 | bb_error_msg_and_die("bad -t parameter"); | 464 | bb_simple_error_msg_and_die("bad -t parameter"); |
465 | key_separator = str_t[0]; | 465 | key_separator = str_t[0]; |
466 | } | 466 | } |
467 | /* note: below this point we use option_mask32, not opts, | 467 | /* note: below this point we use option_mask32, not opts, |
@@ -504,10 +504,10 @@ int sort_main(int argc UNUSED_PARAM, char **argv) | |||
504 | because comma isn't in OPT_STR */ | 504 | because comma isn't in OPT_STR */ |
505 | idx = strchr(OPT_STR, *str_k); | 505 | idx = strchr(OPT_STR, *str_k); |
506 | if (!idx) | 506 | if (!idx) |
507 | bb_error_msg_and_die("unknown key option"); | 507 | bb_simple_error_msg_and_die("unknown key option"); |
508 | flag = 1 << (idx - OPT_STR); | 508 | flag = 1 << (idx - OPT_STR); |
509 | if (flag & ~FLAG_allowed_for_k) | 509 | if (flag & ~FLAG_allowed_for_k) |
510 | bb_error_msg_and_die("unknown sort type"); | 510 | bb_simple_error_msg_and_die("unknown sort type"); |
511 | /* b after ',' means strip _trailing_ space */ | 511 | /* b after ',' means strip _trailing_ space */ |
512 | if (i && flag == FLAG_b) | 512 | if (i && flag == FLAG_b) |
513 | flag = FLAG_bb; | 513 | flag = FLAG_bb; |
diff --git a/coreutils/split.c b/coreutils/split.c index c1e4ceab2..ecbc9d2d8 100644 --- a/coreutils/split.c +++ b/coreutils/split.c | |||
@@ -127,7 +127,7 @@ int split_main(int argc UNUSED_PARAM, char **argv) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | if (NAME_MAX < strlen(sfx) + suffix_len) | 129 | if (NAME_MAX < strlen(sfx) + suffix_len) |
130 | bb_error_msg_and_die("suffix too long"); | 130 | bb_simple_error_msg_and_die("suffix too long"); |
131 | 131 | ||
132 | { | 132 | { |
133 | char *char_p = xzalloc(suffix_len + 1); | 133 | char *char_p = xzalloc(suffix_len + 1); |
@@ -147,7 +147,7 @@ int split_main(int argc UNUSED_PARAM, char **argv) | |||
147 | do { | 147 | do { |
148 | if (!remaining) { | 148 | if (!remaining) { |
149 | if (!pfx) | 149 | if (!pfx) |
150 | bb_error_msg_and_die("suffixes exhausted"); | 150 | bb_simple_error_msg_and_die("suffixes exhausted"); |
151 | xmove_fd(xopen(pfx, O_WRONLY | O_CREAT | O_TRUNC), 1); | 151 | xmove_fd(xopen(pfx, O_WRONLY | O_CREAT | O_TRUNC), 1); |
152 | pfx = next_file(pfx, suffix_len); | 152 | pfx = next_file(pfx, suffix_len); |
153 | remaining = cnt; | 153 | remaining = cnt; |
diff --git a/coreutils/stat.c b/coreutils/stat.c index d9287b34e..c332e5dc8 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -149,20 +149,16 @@ static const char *file_type(const struct stat *st) | |||
149 | return "weird file"; | 149 | return "weird file"; |
150 | } | 150 | } |
151 | 151 | ||
152 | static const char *human_time(time_t t) | 152 | static const char *human_time(struct timespec *ts) |
153 | { | 153 | { |
154 | /* Old | 154 | char fmt[sizeof("%Y-%m-%d %H:%M:%S.123456789 %z") + /*paranoia*/ 8]; |
155 | static char *str; | 155 | |
156 | str = ctime(&t); | 156 | /* coreutils 6.3 compat */ |
157 | str[strlen(str)-1] = '\0'; | ||
158 | return str; | ||
159 | */ | ||
160 | /* coreutils 6.3 compat: */ | ||
161 | |||
162 | /*static char buf[sizeof("YYYY-MM-DD HH:MM:SS.000000000")] ALIGN1;*/ | ||
163 | #define buf bb_common_bufsiz1 | 157 | #define buf bb_common_bufsiz1 |
164 | setup_common_bufsiz(); | 158 | setup_common_bufsiz(); |
165 | strcpy(strftime_YYYYMMDDHHMMSS(buf, COMMON_BUFSIZE, &t), ".000000000"); | 159 | |
160 | sprintf(stpcpy(fmt, "%Y-%m-%d %H:%M:%S"), ".%09u %%z", (unsigned)ts->tv_nsec); | ||
161 | strftime(buf, COMMON_BUFSIZE, fmt, localtime(&ts->tv_sec)); | ||
166 | return buf; | 162 | return buf; |
167 | #undef buf | 163 | #undef buf |
168 | } | 164 | } |
@@ -388,19 +384,19 @@ static void FAST_FUNC print_stat(char *pformat, const char m, | |||
388 | strcat(pformat, "lu"); | 384 | strcat(pformat, "lu"); |
389 | printf(pformat, (unsigned long) statbuf->st_blksize); | 385 | printf(pformat, (unsigned long) statbuf->st_blksize); |
390 | } else if (m == 'x') { | 386 | } else if (m == 'x') { |
391 | printfs(pformat, human_time(statbuf->st_atime)); | 387 | printfs(pformat, human_time(&statbuf->st_atim)); |
392 | } else if (m == 'X') { | 388 | } else if (m == 'X') { |
393 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); | 389 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); |
394 | /* note: (unsigned long) would be wrong: | 390 | /* note: (unsigned long) would be wrong: |
395 | * imagine (unsigned long64)int32 */ | 391 | * imagine (unsigned long64)int32 */ |
396 | printf(pformat, (long) statbuf->st_atime); | 392 | printf(pformat, (long) statbuf->st_atime); |
397 | } else if (m == 'y') { | 393 | } else if (m == 'y') { |
398 | printfs(pformat, human_time(statbuf->st_mtime)); | 394 | printfs(pformat, human_time(&statbuf->st_mtim)); |
399 | } else if (m == 'Y') { | 395 | } else if (m == 'Y') { |
400 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); | 396 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); |
401 | printf(pformat, (long) statbuf->st_mtime); | 397 | printf(pformat, (long) statbuf->st_mtime); |
402 | } else if (m == 'z') { | 398 | } else if (m == 'z') { |
403 | printfs(pformat, human_time(statbuf->st_ctime)); | 399 | printfs(pformat, human_time(&statbuf->st_ctim)); |
404 | } else if (m == 'Z') { | 400 | } else if (m == 'Z') { |
405 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); | 401 | strcat(pformat, TYPE_SIGNED(time_t) ? "ld" : "lu"); |
406 | printf(pformat, (long) statbuf->st_ctime); | 402 | printf(pformat, (long) statbuf->st_ctime); |
@@ -505,7 +501,7 @@ static bool do_statfs(const char *filename, const char *format) | |||
505 | if (format == NULL) { | 501 | if (format == NULL) { |
506 | # if !ENABLE_SELINUX | 502 | # if !ENABLE_SELINUX |
507 | format = (option_mask32 & OPT_TERSE | 503 | format = (option_mask32 & OPT_TERSE |
508 | ? "%n %i %l %t %s %b %f %a %c %d\n" | 504 | ? "%n %i %l %t %s %b %f %a %c %d" |
509 | : " File: \"%n\"\n" | 505 | : " File: \"%n\"\n" |
510 | " ID: %-8i Namelen: %-7l Type: %T\n" | 506 | " ID: %-8i Namelen: %-7l Type: %T\n" |
511 | "Block size: %-10s\n" | 507 | "Block size: %-10s\n" |
@@ -513,25 +509,26 @@ static bool do_statfs(const char *filename, const char *format) | |||
513 | "Inodes: Total: %-10c Free: %d"); | 509 | "Inodes: Total: %-10c Free: %d"); |
514 | # else | 510 | # else |
515 | format = (option_mask32 & OPT_TERSE | 511 | format = (option_mask32 & OPT_TERSE |
516 | ? (option_mask32 & OPT_SELINUX ? "%n %i %l %t %s %b %f %a %c %d %C\n": | 512 | ? (option_mask32 & OPT_SELINUX |
517 | "%n %i %l %t %s %b %f %a %c %d\n") | 513 | ? "%n %i %l %t %s %b %f %a %c %d %C" |
518 | : (option_mask32 & OPT_SELINUX ? | 514 | : "%n %i %l %t %s %b %f %a %c %d") |
519 | " File: \"%n\"\n" | 515 | : (option_mask32 & OPT_SELINUX |
520 | " ID: %-8i Namelen: %-7l Type: %T\n" | 516 | ? " File: \"%n\"\n" |
521 | "Block size: %-10s\n" | 517 | " ID: %-8i Namelen: %-7l Type: %T\n" |
522 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" | 518 | "Block size: %-10s\n" |
523 | "Inodes: Total: %-10c Free: %d" | 519 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" |
524 | " S_context: %C\n": | 520 | "Inodes: Total: %-10c Free: %d" |
525 | " File: \"%n\"\n" | 521 | " S_context: %C" |
526 | " ID: %-8i Namelen: %-7l Type: %T\n" | 522 | : " File: \"%n\"\n" |
527 | "Block size: %-10s\n" | 523 | " ID: %-8i Namelen: %-7l Type: %T\n" |
528 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" | 524 | "Block size: %-10s\n" |
529 | "Inodes: Total: %-10c Free: %d\n") | 525 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" |
526 | "Inodes: Total: %-10c Free: %d") | ||
530 | ); | 527 | ); |
531 | # endif /* SELINUX */ | 528 | # endif /* SELINUX */ |
532 | } | 529 | } |
533 | print_it(format, filename, print_statfs, &statfsbuf IF_SELINUX(, scontext)); | 530 | print_it(format, filename, print_statfs, &statfsbuf IF_SELINUX(, scontext)); |
534 | #else /* FEATURE_STAT_FORMAT */ | 531 | #else /* !FEATURE_STAT_FORMAT */ |
535 | format = (option_mask32 & OPT_TERSE | 532 | format = (option_mask32 & OPT_TERSE |
536 | ? "%s %llx %lu " | 533 | ? "%s %llx %lu " |
537 | : " File: \"%s\"\n" | 534 | : " File: \"%s\"\n" |
@@ -628,14 +625,14 @@ static bool do_stat(const char *filename, const char *format) | |||
628 | "Device: %Dh/%dd\tInode: %-10i Links: %-5h" | 625 | "Device: %Dh/%dd\tInode: %-10i Links: %-5h" |
629 | " Device type: %t,%T\n" | 626 | " Device type: %t,%T\n" |
630 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" | 627 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" |
631 | "Access: %x\n" "Modify: %y\n" "Change: %z\n"; | 628 | "Access: %x\n" "Modify: %y\n" "Change: %z"; |
632 | } else { | 629 | } else { |
633 | format = | 630 | format = |
634 | " File: %N\n" | 631 | " File: %N\n" |
635 | " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" | 632 | " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" |
636 | "Device: %Dh/%dd\tInode: %-10i Links: %h\n" | 633 | "Device: %Dh/%dd\tInode: %-10i Links: %h\n" |
637 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" | 634 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" |
638 | "Access: %x\n" "Modify: %y\n" "Change: %z\n"; | 635 | "Access: %x\n" "Modify: %y\n" "Change: %z"; |
639 | } | 636 | } |
640 | } | 637 | } |
641 | # else | 638 | # else |
@@ -654,14 +651,14 @@ static bool do_stat(const char *filename, const char *format) | |||
654 | " Device type: %t,%T\n" | 651 | " Device type: %t,%T\n" |
655 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" | 652 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" |
656 | " S_Context: %C\n" | 653 | " S_Context: %C\n" |
657 | "Access: %x\n" "Modify: %y\n" "Change: %z\n" | 654 | "Access: %x\n" "Modify: %y\n" "Change: %z" |
658 | : | 655 | : |
659 | " File: %N\n" | 656 | " File: %N\n" |
660 | " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" | 657 | " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" |
661 | "Device: %Dh/%dd\tInode: %-10i Links: %-5h" | 658 | "Device: %Dh/%dd\tInode: %-10i Links: %-5h" |
662 | " Device type: %t,%T\n" | 659 | " Device type: %t,%T\n" |
663 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" | 660 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" |
664 | "Access: %x\n" "Modify: %y\n" "Change: %z\n" | 661 | "Access: %x\n" "Modify: %y\n" "Change: %z" |
665 | ); | 662 | ); |
666 | } else { | 663 | } else { |
667 | format = (option_mask32 & OPT_SELINUX ? | 664 | format = (option_mask32 & OPT_SELINUX ? |
@@ -670,13 +667,13 @@ static bool do_stat(const char *filename, const char *format) | |||
670 | "Device: %Dh/%dd\tInode: %-10i Links: %h\n" | 667 | "Device: %Dh/%dd\tInode: %-10i Links: %h\n" |
671 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" | 668 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" |
672 | "S_Context: %C\n" | 669 | "S_Context: %C\n" |
673 | "Access: %x\n" "Modify: %y\n" "Change: %z\n" | 670 | "Access: %x\n" "Modify: %y\n" "Change: %z" |
674 | : | 671 | : |
675 | " File: %N\n" | 672 | " File: %N\n" |
676 | " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" | 673 | " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" |
677 | "Device: %Dh/%dd\tInode: %-10i Links: %h\n" | 674 | "Device: %Dh/%dd\tInode: %-10i Links: %h\n" |
678 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" | 675 | "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" |
679 | "Access: %x\n" "Modify: %y\n" "Change: %z\n" | 676 | "Access: %x\n" "Modify: %y\n" "Change: %z" |
680 | ); | 677 | ); |
681 | } | 678 | } |
682 | } | 679 | } |
@@ -757,9 +754,9 @@ static bool do_stat(const char *filename, const char *format) | |||
757 | if (option_mask32 & OPT_SELINUX) | 754 | if (option_mask32 & OPT_SELINUX) |
758 | printf(" S_Context: %s\n", scontext); | 755 | printf(" S_Context: %s\n", scontext); |
759 | # endif | 756 | # endif |
760 | printf("Access: %s\n", human_time(statbuf.st_atime)); | 757 | printf("Access: %s\n", human_time(&statbuf.st_atim)); |
761 | printf("Modify: %s\n", human_time(statbuf.st_mtime)); | 758 | printf("Modify: %s\n", human_time(&statbuf.st_mtim)); |
762 | printf("Change: %s\n", human_time(statbuf.st_ctime)); | 759 | printf("Change: %s\n", human_time(&statbuf.st_ctim)); |
763 | } | 760 | } |
764 | #endif /* FEATURE_STAT_FORMAT */ | 761 | #endif /* FEATURE_STAT_FORMAT */ |
765 | return 1; | 762 | return 1; |
diff --git a/coreutils/stty.c b/coreutils/stty.c index d1309f9aa..40e812799 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -1320,7 +1320,7 @@ int stty_main(int argc UNUSED_PARAM, char **argv) | |||
1320 | break; | 1320 | break; |
1321 | case 'F': | 1321 | case 'F': |
1322 | if (file_name) | 1322 | if (file_name) |
1323 | bb_error_msg_and_die("only one device may be specified"); | 1323 | bb_simple_error_msg_and_die("only one device may be specified"); |
1324 | file_name = &arg[i+1]; /* "-Fdevice" ? */ | 1324 | file_name = &arg[i+1]; /* "-Fdevice" ? */ |
1325 | if (!file_name[0]) { /* nope, "-F device" */ | 1325 | if (!file_name[0]) { /* nope, "-F device" */ |
1326 | int p = k+1; /* argv[p] is argnext */ | 1326 | int p = k+1; /* argv[p] is argnext */ |
@@ -1405,13 +1405,13 @@ int stty_main(int argc UNUSED_PARAM, char **argv) | |||
1405 | if ((stty_state & (STTY_verbose_output | STTY_recoverable_output)) == | 1405 | if ((stty_state & (STTY_verbose_output | STTY_recoverable_output)) == |
1406 | (STTY_verbose_output | STTY_recoverable_output) | 1406 | (STTY_verbose_output | STTY_recoverable_output) |
1407 | ) { | 1407 | ) { |
1408 | bb_error_msg_and_die("-a and -g are mutually exclusive"); | 1408 | bb_simple_error_msg_and_die("-a and -g are mutually exclusive"); |
1409 | } | 1409 | } |
1410 | /* Specifying -a or -g with non-options is an error */ | 1410 | /* Specifying -a or -g with non-options is an error */ |
1411 | if ((stty_state & (STTY_verbose_output | STTY_recoverable_output)) | 1411 | if ((stty_state & (STTY_verbose_output | STTY_recoverable_output)) |
1412 | && !(stty_state & STTY_noargs) | 1412 | && !(stty_state & STTY_noargs) |
1413 | ) { | 1413 | ) { |
1414 | bb_error_msg_and_die("modes may not be set when -a or -g is used"); | 1414 | bb_simple_error_msg_and_die("modes may not be set when -a or -g is used"); |
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | /* Now it is safe to start doing things */ | 1417 | /* Now it is safe to start doing things */ |
diff --git a/coreutils/tail.c b/coreutils/tail.c index 14ed85d16..1f458f9ed 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -89,7 +89,7 @@ static ssize_t tail_read(int fd, char *buf, size_t count) | |||
89 | 89 | ||
90 | r = full_read(fd, buf, count); | 90 | r = full_read(fd, buf, count); |
91 | if (r < 0) { | 91 | if (r < 0) { |
92 | bb_perror_msg(bb_msg_read_error); | 92 | bb_simple_perror_msg(bb_msg_read_error); |
93 | G.exitcode = EXIT_FAILURE; | 93 | G.exitcode = EXIT_FAILURE; |
94 | } | 94 | } |
95 | 95 | ||
@@ -186,7 +186,7 @@ int tail_main(int argc, char **argv) | |||
186 | } while (++i < argc); | 186 | } while (++i < argc); |
187 | 187 | ||
188 | if (!nfiles) | 188 | if (!nfiles) |
189 | bb_error_msg_and_die("no files"); | 189 | bb_simple_error_msg_and_die("no files"); |
190 | 190 | ||
191 | /* prepare the buffer */ | 191 | /* prepare the buffer */ |
192 | tailbufsize = BUFSIZ; | 192 | tailbufsize = BUFSIZ; |
diff --git a/coreutils/test.c b/coreutils/test.c index 8d7dac025..868ffbecb 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -832,12 +832,12 @@ int test_main(int argc, char **argv) | |||
832 | --argc; | 832 | --argc; |
833 | if (!arg0[1]) { /* "[" ? */ | 833 | if (!arg0[1]) { /* "[" ? */ |
834 | if (NOT_LONE_CHAR(argv[argc], ']')) { | 834 | if (NOT_LONE_CHAR(argv[argc], ']')) { |
835 | bb_error_msg("missing ]"); | 835 | bb_simple_error_msg("missing ]"); |
836 | return 2; | 836 | return 2; |
837 | } | 837 | } |
838 | } else { /* assuming "[[" */ | 838 | } else { /* assuming "[[" */ |
839 | if (strcmp(argv[argc], "]]") != 0) { | 839 | if (strcmp(argv[argc], "]]") != 0) { |
840 | bb_error_msg("missing ]]"); | 840 | bb_simple_error_msg("missing ]]"); |
841 | return 2; | 841 | return 2; |
842 | } | 842 | } |
843 | } | 843 | } |
diff --git a/coreutils/tr.c b/coreutils/tr.c index ae35a9ee3..1e402dfdb 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -308,7 +308,7 @@ int tr_main(int argc UNUSED_PARAM, char **argv) | |||
308 | str1_length = complement(str1, str1_length); | 308 | str1_length = complement(str1, str1_length); |
309 | if (*argv) { | 309 | if (*argv) { |
310 | if (argv[0][0] == '\0') | 310 | if (argv[0][0] == '\0') |
311 | bb_error_msg_and_die("STRING2 cannot be empty"); | 311 | bb_simple_error_msg_and_die("STRING2 cannot be empty"); |
312 | str2_length = expand(*argv, &str2); | 312 | str2_length = expand(*argv, &str2); |
313 | map(vector, str1, str1_length, | 313 | map(vector, str1, str1_length, |
314 | str2, str2_length); | 314 | str2, str2_length); |
@@ -333,7 +333,7 @@ int tr_main(int argc UNUSED_PARAM, char **argv) | |||
333 | read_chars = safe_read(STDIN_FILENO, str1, TR_BUFSIZ); | 333 | read_chars = safe_read(STDIN_FILENO, str1, TR_BUFSIZ); |
334 | if (read_chars <= 0) { | 334 | if (read_chars <= 0) { |
335 | if (read_chars < 0) | 335 | if (read_chars < 0) |
336 | bb_perror_msg_and_die(bb_msg_read_error); | 336 | bb_simple_perror_msg_and_die(bb_msg_read_error); |
337 | break; | 337 | break; |
338 | } | 338 | } |
339 | in_index = 0; | 339 | in_index = 0; |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 5f69e62b3..dc8ef5cca 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -82,7 +82,7 @@ static void FAST_FUNC read_stduu(FILE *src_stream, FILE *dst_stream, int flags U | |||
82 | continue; | 82 | continue; |
83 | } | 83 | } |
84 | if (encoded_len > 60) { | 84 | if (encoded_len > 60) { |
85 | bb_error_msg_and_die("line too long"); | 85 | bb_simple_error_msg_and_die("line too long"); |
86 | } | 86 | } |
87 | 87 | ||
88 | dst = line; | 88 | dst = line; |
@@ -108,7 +108,7 @@ static void FAST_FUNC read_stduu(FILE *src_stream, FILE *dst_stream, int flags U | |||
108 | fwrite(line, 1, dst - line, dst_stream); | 108 | fwrite(line, 1, dst - line, dst_stream); |
109 | free(line); | 109 | free(line); |
110 | } | 110 | } |
111 | bb_error_msg_and_die("short file"); | 111 | bb_simple_error_msg_and_die("short file"); |
112 | } | 112 | } |
113 | #endif | 113 | #endif |
114 | 114 | ||
@@ -166,7 +166,7 @@ int uudecode_main(int argc UNUSED_PARAM, char **argv) | |||
166 | /* fclose_if_not_stdin(src_stream); - redundant */ | 166 | /* fclose_if_not_stdin(src_stream); - redundant */ |
167 | return EXIT_SUCCESS; | 167 | return EXIT_SUCCESS; |
168 | } | 168 | } |
169 | bb_error_msg_and_die("no 'begin' line"); | 169 | bb_simple_error_msg_and_die("no 'begin' line"); |
170 | } | 170 | } |
171 | #endif | 171 | #endif |
172 | 172 | ||
@@ -216,7 +216,7 @@ int base64_main(int argc UNUSED_PARAM, char **argv) | |||
216 | if (!size) | 216 | if (!size) |
217 | break; | 217 | break; |
218 | if ((ssize_t)size < 0) | 218 | if ((ssize_t)size < 0) |
219 | bb_perror_msg_and_die(bb_msg_read_error); | 219 | bb_simple_perror_msg_and_die(bb_msg_read_error); |
220 | /* Encode the buffer we just read in */ | 220 | /* Encode the buffer we just read in */ |
221 | bb_uuencode(dst_buf, src_buf, size, bb_uuenc_tbl_base64); | 221 | bb_uuencode(dst_buf, src_buf, size, bb_uuenc_tbl_base64); |
222 | xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3)); | 222 | xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3)); |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 2807ef82a..db49ec80a 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -66,7 +66,7 @@ int uuencode_main(int argc UNUSED_PARAM, char **argv) | |||
66 | if (!size) | 66 | if (!size) |
67 | break; | 67 | break; |
68 | if ((ssize_t)size < 0) | 68 | if ((ssize_t)size < 0) |
69 | bb_perror_msg_and_die(bb_msg_read_error); | 69 | bb_simple_perror_msg_and_die(bb_msg_read_error); |
70 | /* Encode the buffer we just read in */ | 70 | /* Encode the buffer we just read in */ |
71 | bb_uuencode(dst_buf, src_buf, size, tbl); | 71 | bb_uuencode(dst_buf, src_buf, size, tbl); |
72 | bb_putchar('\n'); | 72 | bb_putchar('\n'); |