diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/chroot.c | 4 | ||||
-rw-r--r-- | coreutils/cut.c | 2 | ||||
-rw-r--r-- | coreutils/head.c | 2 | ||||
-rw-r--r-- | coreutils/ls.c | 6 | ||||
-rw-r--r-- | coreutils/md5sum.c | 10 | ||||
-rw-r--r-- | coreutils/pwd.c | 4 | ||||
-rw-r--r-- | coreutils/tee.c | 2 | ||||
-rw-r--r-- | coreutils/uudecode.c | 4 | ||||
-rw-r--r-- | coreutils/uuencode.c | 7 |
9 files changed, 19 insertions, 22 deletions
diff --git a/coreutils/chroot.c b/coreutils/chroot.c index 34daf7f25..91d3407f2 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c | |||
@@ -38,7 +38,7 @@ int chroot_main(int argc, char **argv) | |||
38 | argv++; | 38 | argv++; |
39 | 39 | ||
40 | if (chroot(*argv) || (chdir("/"))) { | 40 | if (chroot(*argv) || (chdir("/"))) { |
41 | error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno)); | 41 | perror_msg_and_die("cannot change root directory to %s", *argv); |
42 | } | 42 | } |
43 | 43 | ||
44 | argc--; | 44 | argc--; |
@@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv) | |||
57 | return EXIT_SUCCESS; | 57 | return EXIT_SUCCESS; |
58 | #endif | 58 | #endif |
59 | } | 59 | } |
60 | error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno)); | 60 | perror_msg_and_die("cannot execute %s", prog); |
61 | 61 | ||
62 | } | 62 | } |
63 | 63 | ||
diff --git a/coreutils/cut.c b/coreutils/cut.c index 8b319962d..62f9e8731 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -234,7 +234,7 @@ extern int cut_main(int argc, char **argv) | |||
234 | for (i = optind; i < argc; i++) { | 234 | for (i = optind; i < argc; i++) { |
235 | file = fopen(argv[i], "r"); | 235 | file = fopen(argv[i], "r"); |
236 | if (file == NULL) { | 236 | if (file == NULL) { |
237 | error_msg("%s: %s\n", argv[i], strerror(errno)); | 237 | perror_msg("%s", argv[i]); |
238 | } else { | 238 | } else { |
239 | cut_file(file); | 239 | cut_file(file); |
240 | fclose(file); | 240 | fclose(file); |
diff --git a/coreutils/head.c b/coreutils/head.c index f3aef1b9b..6e05eded5 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -80,7 +80,7 @@ int head_main(int argc, char **argv) | |||
80 | } | 80 | } |
81 | head(len, fp); | 81 | head(len, fp); |
82 | if (errno) { | 82 | if (errno) { |
83 | error_msg("%s: %s\n", argv[optind], strerror(errno)); | 83 | perror_msg("%s", argv[optind]); |
84 | status = EXIT_FAILURE; | 84 | status = EXIT_FAILURE; |
85 | errno = 0; | 85 | errno = 0; |
86 | } | 86 | } |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 655dd7ff4..e44bd9b93 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -181,7 +181,7 @@ static int my_stat(struct dnode *cur) | |||
181 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 181 | #ifdef BB_FEATURE_LS_FOLLOWLINKS |
182 | if (follow_links == TRUE) { | 182 | if (follow_links == TRUE) { |
183 | if (stat(cur->fullname, &cur->dstat)) { | 183 | if (stat(cur->fullname, &cur->dstat)) { |
184 | error_msg("%s: %s\n", cur->fullname, strerror(errno)); | 184 | perror_msg("%s", cur->fullname); |
185 | status = EXIT_FAILURE; | 185 | status = EXIT_FAILURE; |
186 | free(cur->fullname); | 186 | free(cur->fullname); |
187 | free(cur); | 187 | free(cur); |
@@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur) | |||
190 | } else | 190 | } else |
191 | #endif | 191 | #endif |
192 | if (lstat(cur->fullname, &cur->dstat)) { | 192 | if (lstat(cur->fullname, &cur->dstat)) { |
193 | error_msg("%s: %s\n", cur->fullname, strerror(errno)); | 193 | perror_msg("%s", cur->fullname); |
194 | status = EXIT_FAILURE; | 194 | status = EXIT_FAILURE; |
195 | free(cur->fullname); | 195 | free(cur->fullname); |
196 | free(cur); | 196 | free(cur); |
@@ -511,7 +511,7 @@ struct dnode **list_dir(char *path) | |||
511 | nfiles= 0; | 511 | nfiles= 0; |
512 | dir = opendir(path); | 512 | dir = opendir(path); |
513 | if (dir == NULL) { | 513 | if (dir == NULL) { |
514 | error_msg("%s: %s\n", path, strerror(errno)); | 514 | perror_msg("%s", path); |
515 | status = EXIT_FAILURE; | 515 | status = EXIT_FAILURE; |
516 | return(NULL); /* could not open the dir */ | 516 | return(NULL); /* could not open the dir */ |
517 | } | 517 | } |
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c index 57fac7450..ecc1458a2 100644 --- a/coreutils/md5sum.c +++ b/coreutils/md5sum.c | |||
@@ -651,13 +651,13 @@ static int md5_file(const char *filename, | |||
651 | } else { | 651 | } else { |
652 | fp = fopen(filename, OPENOPTS(binary)); | 652 | fp = fopen(filename, OPENOPTS(binary)); |
653 | if (fp == NULL) { | 653 | if (fp == NULL) { |
654 | error_msg("%s: %s\n", filename, strerror(errno)); | 654 | perror_msg("%s", filename); |
655 | return FALSE; | 655 | return FALSE; |
656 | } | 656 | } |
657 | } | 657 | } |
658 | 658 | ||
659 | if (md5_stream(fp, md5_result)) { | 659 | if (md5_stream(fp, md5_result)) { |
660 | error_msg("%s: %s\n", filename, strerror(errno)); | 660 | perror_msg("%s", filename); |
661 | 661 | ||
662 | if (fp != stdin) | 662 | if (fp != stdin) |
663 | fclose(fp); | 663 | fclose(fp); |
@@ -665,7 +665,7 @@ static int md5_file(const char *filename, | |||
665 | } | 665 | } |
666 | 666 | ||
667 | if (fp != stdin && fclose(fp) == EOF) { | 667 | if (fp != stdin && fclose(fp) == EOF) { |
668 | error_msg("%s: %s\n", filename, strerror(errno)); | 668 | perror_msg("%s", filename); |
669 | return FALSE; | 669 | return FALSE; |
670 | } | 670 | } |
671 | 671 | ||
@@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name) | |||
689 | } else { | 689 | } else { |
690 | checkfile_stream = fopen(checkfile_name, "r"); | 690 | checkfile_stream = fopen(checkfile_name, "r"); |
691 | if (checkfile_stream == NULL) { | 691 | if (checkfile_stream == NULL) { |
692 | error_msg("%s: %s\n", checkfile_name, strerror(errno)); | 692 | perror_msg("%s", checkfile_name); |
693 | return FALSE; | 693 | return FALSE; |
694 | } | 694 | } |
695 | } | 695 | } |
@@ -775,7 +775,7 @@ static int md5_check(const char *checkfile_name) | |||
775 | } | 775 | } |
776 | 776 | ||
777 | if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { | 777 | if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { |
778 | error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno)); | 778 | perror_msg("md5sum: %s", checkfile_name); |
779 | return FALSE; | 779 | return FALSE; |
780 | } | 780 | } |
781 | 781 | ||
diff --git a/coreutils/pwd.c b/coreutils/pwd.c index 71731944c..da089f37c 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c | |||
@@ -31,8 +31,8 @@ extern int pwd_main(int argc, char **argv) | |||
31 | char buf[BUFSIZ + 1]; | 31 | char buf[BUFSIZ + 1]; |
32 | 32 | ||
33 | if (getcwd(buf, sizeof(buf)) == NULL) | 33 | if (getcwd(buf, sizeof(buf)) == NULL) |
34 | error_msg_and_die("%s\n", strerror(errno)); | 34 | perror_msg_and_die("getcwd"); |
35 | 35 | ||
36 | printf("%s\n", buf); | 36 | puts(buf); |
37 | return EXIT_SUCCESS; | 37 | return EXIT_SUCCESS; |
38 | } | 38 | } |
diff --git a/coreutils/tee.c b/coreutils/tee.c index 347684a28..f0eca070d 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -47,7 +47,7 @@ tee_main(int argc, char **argv) | |||
47 | while (optind < argc) { | 47 | while (optind < argc) { |
48 | if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) { | 48 | if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) { |
49 | nfiles--; | 49 | nfiles--; |
50 | error_msg("%s: %s\n", argv[optind-1], strerror(errno)); | 50 | perror_msg("%s", argv[optind-1]); |
51 | status = 1; | 51 | status = 1; |
52 | } | 52 | } |
53 | } | 53 | } |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index ff4a9d9e6..279b9d6ce 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -257,7 +257,7 @@ static int decode (const char *inname, | |||
257 | && (freopen (outname, "w", stdout) == NULL | 257 | && (freopen (outname, "w", stdout) == NULL |
258 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) | 258 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) |
259 | )) { | 259 | )) { |
260 | error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */ | 260 | perror_msg("%s", outname); /* */ |
261 | return FALSE; | 261 | return FALSE; |
262 | } | 262 | } |
263 | 263 | ||
@@ -302,7 +302,7 @@ int uudecode_main (int argc, | |||
302 | if (decode (argv[optind], outname) != 0) | 302 | if (decode (argv[optind], outname) != 0) |
303 | exit_status = FALSE; | 303 | exit_status = FALSE; |
304 | } else { | 304 | } else { |
305 | error_msg("%s: %s\n", argv[optind], strerror(errno)); | 305 | perror_msg("%s", argv[optind]); |
306 | exit_status = EXIT_FAILURE; | 306 | exit_status = EXIT_FAILURE; |
307 | } | 307 | } |
308 | optind++; | 308 | optind++; |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 41e659075..36bc4970f 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -160,15 +160,12 @@ int uuencode_main (int argc, | |||
160 | trans_ptr = uu_std; /* Standard encoding is old uu format */ | 160 | trans_ptr = uu_std; /* Standard encoding is old uu format */ |
161 | 161 | ||
162 | /* Parse any options */ | 162 | /* Parse any options */ |
163 | while ((opt = getopt (argc, argv, "m")) != EOF) { | 163 | while ((opt = getopt (argc, argv, "m")) > 0) { |
164 | switch (opt) { | 164 | switch (opt) { |
165 | case 'm': | 165 | case 'm': |
166 | trans_ptr = uu_base64; | 166 | trans_ptr = uu_base64; |
167 | break; | 167 | break; |
168 | 168 | ||
169 | case 0: | ||
170 | break; | ||
171 | |||
172 | default: | 169 | default: |
173 | usage(uuencode_usage); | 170 | usage(uuencode_usage); |
174 | } | 171 | } |
@@ -178,7 +175,7 @@ int uuencode_main (int argc, | |||
178 | case 2: | 175 | case 2: |
179 | /* Optional first argument is input file. */ | 176 | /* Optional first argument is input file. */ |
180 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { | 177 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { |
181 | error_msg("%s: %s\n", argv[optind], strerror(errno)); | 178 | perror_msg("%s", argv[optind]); |
182 | return EXIT_FAILURE; | 179 | return EXIT_FAILURE; |
183 | } | 180 | } |
184 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); | 181 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); |