diff options
author | Matt Kraai | 2000-07-14 01:51:25 +0000 |
---|---|---|
committer | Matt Kraai | 2000-07-14 01:51:25 +0000 |
commit | d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb (patch) | |
tree | 62127f20fc07758e445d8c4e186306cbe83d77b1 /coreutils | |
parent | 4ac6cb534d78d63d7b0a206118c56bad7024b9f8 (diff) | |
download | busybox-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.zip busybox-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.gz |
Use errorMsg rather than fprintf.
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cut.c | 24 | ||||
-rw-r--r-- | coreutils/dd.c | 8 | ||||
-rw-r--r-- | coreutils/df.c | 2 | ||||
-rw-r--r-- | coreutils/du.c | 6 | ||||
-rw-r--r-- | coreutils/head.c | 7 | ||||
-rw-r--r-- | coreutils/ln.c | 3 | ||||
-rw-r--r-- | coreutils/logname.c | 2 | ||||
-rw-r--r-- | coreutils/mkdir.c | 6 | ||||
-rw-r--r-- | coreutils/rmdir.c | 2 | ||||
-rw-r--r-- | coreutils/sort.c | 4 | ||||
-rw-r--r-- | coreutils/tail.c | 5 | ||||
-rw-r--r-- | coreutils/tee.c | 4 | ||||
-rw-r--r-- | coreutils/uniq.c | 6 | ||||
-rw-r--r-- | coreutils/whoami.c | 3 |
14 files changed, 39 insertions, 43 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c index 820074e..783d526 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -84,13 +84,13 @@ void cut(void); void warn(int warn_number, char *option) { static char *warn_msg[] = { - "%s: Option -%s allowed only with -f\n", - "%s: -%s overrides earlier option\n", - "%s: -%s not allowed in current mode\n", - "%s: Cannot open %s\n" + "Option -%s allowed only with -f\n", + "-%s overrides earlier option\n", + "-%s not allowed in current mode\n", + "Cannot open %s\n" }; - fprintf(stderr, warn_msg[warn_number], applet_name, option); + errorMsg(warn_msg[warn_number], option); exit_status = warn_number + 1; } @@ -98,15 +98,15 @@ void warn(int warn_number, char *option) void cuterror(int err) { static char *err_mes[] = { - "%s: syntax error\n", - "%s: position must be >0\n", - "%s: line longer than BUFSIZ\n", - "%s: range must not decrease from left to right\n", - "%s: MAX_FIELD exceeded\n", - "%s: MAX_ARGS exceeded\n" + "syntax error\n", + "position must be >0\n", + "line longer than BUFSIZ\n", + "range must not decrease from left to right\n", + "MAX_FIELD exceeded\n", + "MAX_ARGS exceeded\n" }; - fprintf(stderr, err_mes[err - 101], applet_name); + errorMsg(err_mes[err - 101]); exit(err); } diff --git a/coreutils/dd.c b/coreutils/dd.c index 5d9993d..6261dfe 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -86,26 +86,26 @@ extern int dd_main(int argc, char **argv) else if (strncmp("count", *argv, 5) == 0) { count = getNum((strchr(*argv, '=')) + 1); if (count <= 0) { - fprintf(stderr, "Bad count value %s\n", *argv); + errorMsg("Bad count value %s\n", *argv); goto usage; } } else if (strncmp(*argv, "bs", 2) == 0) { blockSize = getNum((strchr(*argv, '=')) + 1); if (blockSize <= 0) { - fprintf(stderr, "Bad block size value %s\n", *argv); + errorMsg("Bad block size value %s\n", *argv); goto usage; } } else if (strncmp(*argv, "skip", 4) == 0) { skipBlocks = getNum((strchr(*argv, '=')) + 1); if (skipBlocks <= 0) { - fprintf(stderr, "Bad skip value %s\n", *argv); + errorMsg("Bad skip value %s\n", *argv); goto usage; } } else if (strncmp(*argv, "seek", 4) == 0) { seekBlocks = getNum((strchr(*argv, '=')) + 1); if (seekBlocks <= 0) { - fprintf(stderr, "Bad seek value %s\n", *argv); + errorMsg("Bad seek value %s\n", *argv); goto usage; } diff --git a/coreutils/df.c b/coreutils/df.c index ba3227f..62226ce 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -82,7 +82,7 @@ extern int df_main(int argc, char **argv) } while (argc > 1) { if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { - fprintf(stderr, "%s: can't find mount point.\n", argv[1]); + errorMsg("%s: can't find mount point.\n", argv[1]); exit(FALSE); } status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); diff --git a/coreutils/du.c b/coreutils/du.c index b8e296d..b1ca954 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -108,7 +108,7 @@ static long du(char *filename) } if (len + strlen(name) + 1 > BUFSIZ) { - fprintf(stderr, name_too_long, "du"); + errorMsg(name_too_long); du_depth--; return 0; } @@ -158,7 +158,7 @@ int du_main(int argc, char **argv) usage(du_usage); break; default: - fprintf(stderr, "du: invalid option -- %c\n", opt); + errorMsg("invalid option -- %c\n", opt); usage(du_usage); } } else { @@ -184,7 +184,7 @@ int du_main(int argc, char **argv) return(0); } -/* $Id: du.c,v 1.20 2000/06/19 17:25:39 andersen Exp $ */ +/* $Id: du.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ */ /* Local Variables: c-file-style: "linux" diff --git a/coreutils/head.c b/coreutils/head.c index f42f483..b82678d 100644 --- a/coreutils/head.c +++ b/coreutils/head.c @@ -75,7 +75,7 @@ int head_main(int argc, char **argv) case 'h': usage(head_usage); default: - fprintf(stderr, "head: invalid option -- %c\n", opt); + errorMsg("invalid option -- %c\n", opt); usage(head_usage); } } else { @@ -95,8 +95,7 @@ int head_main(int argc, char **argv) src = fopen(argv[i], "r"); if (!src) { - fprintf(stderr, "head: %s: %s\n", argv[i], - strerror(errno)); + errorMsg("%s: %s\n", argv[i], strerror(errno)); } else { /* emulating GNU behaviour */ if (need_headers) { @@ -112,4 +111,4 @@ int head_main(int argc, char **argv) return(0); } -/* $Id: head.c,v 1.11 2000/06/19 17:25:39 andersen Exp $ */ +/* $Id: head.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ diff --git a/coreutils/ln.c b/coreutils/ln.c index ac1f68e..9f77743 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c @@ -23,7 +23,6 @@ #include "internal.h" #define BB_DECLARE_EXTERN -#define bb_need_name_too_long #define bb_need_not_a_directory #include "messages.c" @@ -92,7 +91,7 @@ extern int ln_main(int argc, char **argv) linkIntoDirFlag = isDirectory(linkName, followLinks, NULL); if ((argc >= 3) && linkIntoDirFlag == FALSE) { - fprintf(stderr, not_a_directory, "ln", linkName); + errorMsg(not_a_directory, linkName); exit FALSE; } diff --git a/coreutils/logname.c b/coreutils/logname.c index 4b4483c..12ebfbd 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c @@ -41,6 +41,6 @@ extern int logname_main(int argc, char **argv) puts(user); exit(TRUE); } - fprintf(stderr, "no login name\n"); + errorMsg("no login name\n"); return(FALSE); } diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index b18c949..f6e08ca 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -62,7 +62,7 @@ extern int mkdir_main(int argc, char **argv) /* Find the specified modes */ mode = 0; if (parse_mode(*(++argv), &mode) == FALSE) { - fprintf(stderr, "Unknown mode: %s\n", *argv); + errorMsg("Unknown mode: %s\n", *argv); exit FALSE; } /* Set the umask for this process so it doesn't @@ -91,13 +91,13 @@ extern int mkdir_main(int argc, char **argv) char buf[BUFSIZ + 1]; if (strlen(*argv) > BUFSIZ - 1) { - fprintf(stderr, name_too_long, "mkdir"); + errorMsg(name_too_long); exit FALSE; } strcpy(buf, *argv); status = stat(buf, &statBuf); if (parentFlag == FALSE && status != -1 && errno != ENOENT) { - fprintf(stderr, "%s: File exists\n", buf); + errorMsg("%s: File exists\n", buf); exit FALSE; } if (parentFlag == TRUE) { diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index c88f42c..4edb9b6 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c @@ -40,7 +40,7 @@ extern int rmdir_main(int argc, char **argv) while (--argc > 0) { if (rmdir(*(++argv)) == -1) { - fprintf(stderr, "%s: %s\n", applet_name, strerror(errno)); + errorMsg("%s\n", strerror(errno)); exit(FALSE); } } diff --git a/coreutils/sort.c b/coreutils/sort.c index a28122d..c754989 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -263,7 +263,7 @@ int sort_main(int argc, char **argv) break; #endif default: - fprintf(stderr, "sort: invalid option -- %c\n", opt); + errorMsg("invalid option -- %c\n", opt); usage(sort_usage); } } else { @@ -304,4 +304,4 @@ int sort_main(int argc, char **argv) return(0); } -/* $Id: sort.c,v 1.18 2000/06/28 22:15:26 markw Exp $ */ +/* $Id: sort.c,v 1.19 2000/07/14 01:51:25 kraai Exp $ */ diff --git a/coreutils/tail.c b/coreutils/tail.c index 3189d20..601f087 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -375,7 +375,7 @@ extern int tail_main(int argc, char **argv) usage(tail_usage); default: if ((n_units = atoi(&argv[i][1])) < 1) { - fprintf(stderr, "tail: invalid option -- %c\n", opt); + errorMsg("invalid option -- %c\n", opt); usage(tail_usage); } } @@ -386,8 +386,7 @@ extern int tail_main(int argc, char **argv) if (i + 1 < argc) { if (forever) { - fprintf(stderr, - "tail: option -f is invalid with multiple files\n"); + errorMsg("option -f is invalid with multiple files\n"); usage(tail_usage); } print_headers = 1; diff --git a/coreutils/tee.c b/coreutils/tee.c index c9b5410..67b42a2 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c @@ -104,7 +104,7 @@ int tee_main(int argc, char **argv) /* init FILE pointers */ FileList = calloc(FL_MAX, sizeof(FILE*)); if (!FileList) { - fprintf(stderr, "tee: %s\n", strerror(errno)); + errorMsg("%s\n", strerror(errno)); exit(1); } FL_end = 0; @@ -133,4 +133,4 @@ int tee_main(int argc, char **argv) return(0); } -/* $Id: tee.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */ +/* $Id: tee.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ diff --git a/coreutils/uniq.c b/coreutils/uniq.c index 64acf04..16b2576 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c @@ -127,11 +127,11 @@ set_file_pointers(int schema, FILE ** in, FILE ** out, char **argv) break; } if (*in == NULL) { - fprintf(stderr, "uniq: %s: %s\n", argv[0], strerror(errno)); + errorMsg("%s: %s\n", argv[0], strerror(errno)); return errno; } if (*out == NULL) { - fprintf(stderr, "uniq: %s: %s\n", argv[1], strerror(errno)); + errorMsg("%s: %s\n", argv[1], strerror(errno)); return errno; } return 0; @@ -187,4 +187,4 @@ int uniq_main(int argc, char **argv) return(0); } -/* $Id: uniq.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */ +/* $Id: uniq.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 983c672..01dff81 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c @@ -43,7 +43,6 @@ extern int whoami_main(int argc, char **argv) puts(user); exit(TRUE); } - fprintf(stderr, "%s: cannot find username for UID %u\n", applet_name, - (unsigned) uid); + errorMsg("cannot find username for UID %u\n", (unsigned) uid); return(FALSE); } |