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) argv++; if (chroot(*argv) || (chdir("/"))) { - error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno)); + perror_msg_and_die("cannot change root directory to %s", *argv); } argc--; @@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv) return EXIT_SUCCESS; #endif } - error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno)); + perror_msg_and_die("cannot execute %s", prog); } 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) for (i = optind; i < argc; i++) { file = fopen(argv[i], "r"); if (file == NULL) { - error_msg("%s: %s\n", argv[i], strerror(errno)); + perror_msg("%s", argv[i]); } else { cut_file(file); 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) } head(len, fp); if (errno) { - error_msg("%s: %s\n", argv[optind], strerror(errno)); + perror_msg("%s", argv[optind]); status = EXIT_FAILURE; errno = 0; } 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) #ifdef BB_FEATURE_LS_FOLLOWLINKS if (follow_links == TRUE) { if (stat(cur->fullname, &cur->dstat)) { - error_msg("%s: %s\n", cur->fullname, strerror(errno)); + perror_msg("%s", cur->fullname); status = EXIT_FAILURE; free(cur->fullname); free(cur); @@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur) } else #endif if (lstat(cur->fullname, &cur->dstat)) { - error_msg("%s: %s\n", cur->fullname, strerror(errno)); + perror_msg("%s", cur->fullname); status = EXIT_FAILURE; free(cur->fullname); free(cur); @@ -511,7 +511,7 @@ struct dnode **list_dir(char *path) nfiles= 0; dir = opendir(path); if (dir == NULL) { - error_msg("%s: %s\n", path, strerror(errno)); + perror_msg("%s", path); status = EXIT_FAILURE; return(NULL); /* could not open the dir */ } 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, } else { fp = fopen(filename, OPENOPTS(binary)); if (fp == NULL) { - error_msg("%s: %s\n", filename, strerror(errno)); + perror_msg("%s", filename); return FALSE; } } if (md5_stream(fp, md5_result)) { - error_msg("%s: %s\n", filename, strerror(errno)); + perror_msg("%s", filename); if (fp != stdin) fclose(fp); @@ -665,7 +665,7 @@ static int md5_file(const char *filename, } if (fp != stdin && fclose(fp) == EOF) { - error_msg("%s: %s\n", filename, strerror(errno)); + perror_msg("%s", filename); return FALSE; } @@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name) } else { checkfile_stream = fopen(checkfile_name, "r"); if (checkfile_stream == NULL) { - error_msg("%s: %s\n", checkfile_name, strerror(errno)); + perror_msg("%s", checkfile_name); return FALSE; } } @@ -775,7 +775,7 @@ static int md5_check(const char *checkfile_name) } if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { - error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno)); + perror_msg("md5sum: %s", checkfile_name); return FALSE; } 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) char buf[BUFSIZ + 1]; if (getcwd(buf, sizeof(buf)) == NULL) - error_msg_and_die("%s\n", strerror(errno)); + perror_msg_and_die("getcwd"); - printf("%s\n", buf); + puts(buf); return EXIT_SUCCESS; } 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) while (optind < argc) { if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) { nfiles--; - error_msg("%s: %s\n", argv[optind-1], strerror(errno)); + perror_msg("%s", argv[optind-1]); status = 1; } } 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, && (freopen (outname, "w", stdout) == NULL || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) )) { - error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */ + perror_msg("%s", outname); /* */ return FALSE; } @@ -302,7 +302,7 @@ int uudecode_main (int argc, if (decode (argv[optind], outname) != 0) exit_status = FALSE; } else { - error_msg("%s: %s\n", argv[optind], strerror(errno)); + perror_msg("%s", argv[optind]); exit_status = EXIT_FAILURE; } 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, trans_ptr = uu_std; /* Standard encoding is old uu format */ /* Parse any options */ - while ((opt = getopt (argc, argv, "m")) != EOF) { + while ((opt = getopt (argc, argv, "m")) > 0) { switch (opt) { case 'm': trans_ptr = uu_base64; break; - case 0: - break; - default: usage(uuencode_usage); } @@ -178,7 +175,7 @@ int uuencode_main (int argc, case 2: /* Optional first argument is input file. */ if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { - error_msg("%s: %s\n", argv[optind], strerror(errno)); + perror_msg("%s", argv[optind]); return EXIT_FAILURE; } mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); |