aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-07-14 01:51:25 +0000
committerkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-07-14 01:51:25 +0000
commited2dfb60ee4a99850e9e68fb27512a0bab4ba992 (patch)
tree62127f20fc07758e445d8c4e186306cbe83d77b1 /coreutils
parentf35f4340a4f7ae02b1139ac9f303e5b8081d71e9 (diff)
downloadbusybox-w32-ed2dfb60ee4a99850e9e68fb27512a0bab4ba992.tar.gz
busybox-w32-ed2dfb60ee4a99850e9e68fb27512a0bab4ba992.tar.bz2
busybox-w32-ed2dfb60ee4a99850e9e68fb27512a0bab4ba992.zip
Use errorMsg rather than fprintf.
git-svn-id: svn://busybox.net/trunk/busybox@848 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/cut.c24
-rw-r--r--coreutils/dd.c8
-rw-r--r--coreutils/df.c2
-rw-r--r--coreutils/du.c6
-rw-r--r--coreutils/head.c7
-rw-r--r--coreutils/ln.c3
-rw-r--r--coreutils/logname.c2
-rw-r--r--coreutils/mkdir.c6
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/sort.c4
-rw-r--r--coreutils/tail.c5
-rw-r--r--coreutils/tee.c4
-rw-r--r--coreutils/uniq.c6
-rw-r--r--coreutils/whoami.c3
14 files changed, 39 insertions, 43 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 820074e60..783d526a5 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -84,13 +84,13 @@ void cut(void);
84void warn(int warn_number, char *option) 84void warn(int warn_number, char *option)
85{ 85{
86 static char *warn_msg[] = { 86 static char *warn_msg[] = {
87 "%s: Option -%s allowed only with -f\n", 87 "Option -%s allowed only with -f\n",
88 "%s: -%s overrides earlier option\n", 88 "-%s overrides earlier option\n",
89 "%s: -%s not allowed in current mode\n", 89 "-%s not allowed in current mode\n",
90 "%s: Cannot open %s\n" 90 "Cannot open %s\n"
91 }; 91 };
92 92
93 fprintf(stderr, warn_msg[warn_number], applet_name, option); 93 errorMsg(warn_msg[warn_number], option);
94 exit_status = warn_number + 1; 94 exit_status = warn_number + 1;
95 95
96} 96}
@@ -98,15 +98,15 @@ void warn(int warn_number, char *option)
98void cuterror(int err) 98void cuterror(int err)
99{ 99{
100 static char *err_mes[] = { 100 static char *err_mes[] = {
101 "%s: syntax error\n", 101 "syntax error\n",
102 "%s: position must be >0\n", 102 "position must be >0\n",
103 "%s: line longer than BUFSIZ\n", 103 "line longer than BUFSIZ\n",
104 "%s: range must not decrease from left to right\n", 104 "range must not decrease from left to right\n",
105 "%s: MAX_FIELD exceeded\n", 105 "MAX_FIELD exceeded\n",
106 "%s: MAX_ARGS exceeded\n" 106 "MAX_ARGS exceeded\n"
107 }; 107 };
108 108
109 fprintf(stderr, err_mes[err - 101], applet_name); 109 errorMsg(err_mes[err - 101]);
110 exit(err); 110 exit(err);
111} 111}
112 112
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 5d9993d8b..6261dfef5 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -86,26 +86,26 @@ extern int dd_main(int argc, char **argv)
86 else if (strncmp("count", *argv, 5) == 0) { 86 else if (strncmp("count", *argv, 5) == 0) {
87 count = getNum((strchr(*argv, '=')) + 1); 87 count = getNum((strchr(*argv, '=')) + 1);
88 if (count <= 0) { 88 if (count <= 0) {
89 fprintf(stderr, "Bad count value %s\n", *argv); 89 errorMsg("Bad count value %s\n", *argv);
90 goto usage; 90 goto usage;
91 } 91 }
92 } else if (strncmp(*argv, "bs", 2) == 0) { 92 } else if (strncmp(*argv, "bs", 2) == 0) {
93 blockSize = getNum((strchr(*argv, '=')) + 1); 93 blockSize = getNum((strchr(*argv, '=')) + 1);
94 if (blockSize <= 0) { 94 if (blockSize <= 0) {
95 fprintf(stderr, "Bad block size value %s\n", *argv); 95 errorMsg("Bad block size value %s\n", *argv);
96 goto usage; 96 goto usage;
97 } 97 }
98 } else if (strncmp(*argv, "skip", 4) == 0) { 98 } else if (strncmp(*argv, "skip", 4) == 0) {
99 skipBlocks = getNum((strchr(*argv, '=')) + 1); 99 skipBlocks = getNum((strchr(*argv, '=')) + 1);
100 if (skipBlocks <= 0) { 100 if (skipBlocks <= 0) {
101 fprintf(stderr, "Bad skip value %s\n", *argv); 101 errorMsg("Bad skip value %s\n", *argv);
102 goto usage; 102 goto usage;
103 } 103 }
104 104
105 } else if (strncmp(*argv, "seek", 4) == 0) { 105 } else if (strncmp(*argv, "seek", 4) == 0) {
106 seekBlocks = getNum((strchr(*argv, '=')) + 1); 106 seekBlocks = getNum((strchr(*argv, '=')) + 1);
107 if (seekBlocks <= 0) { 107 if (seekBlocks <= 0) {
108 fprintf(stderr, "Bad seek value %s\n", *argv); 108 errorMsg("Bad seek value %s\n", *argv);
109 goto usage; 109 goto usage;
110 } 110 }
111 111
diff --git a/coreutils/df.c b/coreutils/df.c
index ba3227f30..62226ceb8 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -82,7 +82,7 @@ extern int df_main(int argc, char **argv)
82 } 82 }
83 while (argc > 1) { 83 while (argc > 1) {
84 if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { 84 if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
85 fprintf(stderr, "%s: can't find mount point.\n", argv[1]); 85 errorMsg("%s: can't find mount point.\n", argv[1]);
86 exit(FALSE); 86 exit(FALSE);
87 } 87 }
88 status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); 88 status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
diff --git a/coreutils/du.c b/coreutils/du.c
index b8e296ddd..b1ca95436 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -108,7 +108,7 @@ static long du(char *filename)
108 } 108 }
109 109
110 if (len + strlen(name) + 1 > BUFSIZ) { 110 if (len + strlen(name) + 1 > BUFSIZ) {
111 fprintf(stderr, name_too_long, "du"); 111 errorMsg(name_too_long);
112 du_depth--; 112 du_depth--;
113 return 0; 113 return 0;
114 } 114 }
@@ -158,7 +158,7 @@ int du_main(int argc, char **argv)
158 usage(du_usage); 158 usage(du_usage);
159 break; 159 break;
160 default: 160 default:
161 fprintf(stderr, "du: invalid option -- %c\n", opt); 161 errorMsg("invalid option -- %c\n", opt);
162 usage(du_usage); 162 usage(du_usage);
163 } 163 }
164 } else { 164 } else {
@@ -184,7 +184,7 @@ int du_main(int argc, char **argv)
184 return(0); 184 return(0);
185} 185}
186 186
187/* $Id: du.c,v 1.20 2000/06/19 17:25:39 andersen Exp $ */ 187/* $Id: du.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ */
188/* 188/*
189Local Variables: 189Local Variables:
190c-file-style: "linux" 190c-file-style: "linux"
diff --git a/coreutils/head.c b/coreutils/head.c
index f42f4837d..b82678dc2 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -75,7 +75,7 @@ int head_main(int argc, char **argv)
75 case 'h': 75 case 'h':
76 usage(head_usage); 76 usage(head_usage);
77 default: 77 default:
78 fprintf(stderr, "head: invalid option -- %c\n", opt); 78 errorMsg("invalid option -- %c\n", opt);
79 usage(head_usage); 79 usage(head_usage);
80 } 80 }
81 } else { 81 } else {
@@ -95,8 +95,7 @@ int head_main(int argc, char **argv)
95 95
96 src = fopen(argv[i], "r"); 96 src = fopen(argv[i], "r");
97 if (!src) { 97 if (!src) {
98 fprintf(stderr, "head: %s: %s\n", argv[i], 98 errorMsg("%s: %s\n", argv[i], strerror(errno));
99 strerror(errno));
100 } else { 99 } else {
101 /* emulating GNU behaviour */ 100 /* emulating GNU behaviour */
102 if (need_headers) { 101 if (need_headers) {
@@ -112,4 +111,4 @@ int head_main(int argc, char **argv)
112 return(0); 111 return(0);
113} 112}
114 113
115/* $Id: head.c,v 1.11 2000/06/19 17:25:39 andersen Exp $ */ 114/* $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 ac1f68e00..9f7774380 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -23,7 +23,6 @@
23 23
24#include "internal.h" 24#include "internal.h"
25#define BB_DECLARE_EXTERN 25#define BB_DECLARE_EXTERN
26#define bb_need_name_too_long
27#define bb_need_not_a_directory 26#define bb_need_not_a_directory
28#include "messages.c" 27#include "messages.c"
29 28
@@ -92,7 +91,7 @@ extern int ln_main(int argc, char **argv)
92 91
93 linkIntoDirFlag = isDirectory(linkName, followLinks, NULL); 92 linkIntoDirFlag = isDirectory(linkName, followLinks, NULL);
94 if ((argc >= 3) && linkIntoDirFlag == FALSE) { 93 if ((argc >= 3) && linkIntoDirFlag == FALSE) {
95 fprintf(stderr, not_a_directory, "ln", linkName); 94 errorMsg(not_a_directory, linkName);
96 exit FALSE; 95 exit FALSE;
97 } 96 }
98 97
diff --git a/coreutils/logname.c b/coreutils/logname.c
index 4b4483cc1..12ebfbde6 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -41,6 +41,6 @@ extern int logname_main(int argc, char **argv)
41 puts(user); 41 puts(user);
42 exit(TRUE); 42 exit(TRUE);
43 } 43 }
44 fprintf(stderr, "no login name\n"); 44 errorMsg("no login name\n");
45 return(FALSE); 45 return(FALSE);
46} 46}
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index b18c949b8..f6e08cadc 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -62,7 +62,7 @@ extern int mkdir_main(int argc, char **argv)
62 /* Find the specified modes */ 62 /* Find the specified modes */
63 mode = 0; 63 mode = 0;
64 if (parse_mode(*(++argv), &mode) == FALSE) { 64 if (parse_mode(*(++argv), &mode) == FALSE) {
65 fprintf(stderr, "Unknown mode: %s\n", *argv); 65 errorMsg("Unknown mode: %s\n", *argv);
66 exit FALSE; 66 exit FALSE;
67 } 67 }
68 /* Set the umask for this process so it doesn't 68 /* Set the umask for this process so it doesn't
@@ -91,13 +91,13 @@ extern int mkdir_main(int argc, char **argv)
91 char buf[BUFSIZ + 1]; 91 char buf[BUFSIZ + 1];
92 92
93 if (strlen(*argv) > BUFSIZ - 1) { 93 if (strlen(*argv) > BUFSIZ - 1) {
94 fprintf(stderr, name_too_long, "mkdir"); 94 errorMsg(name_too_long);
95 exit FALSE; 95 exit FALSE;
96 } 96 }
97 strcpy(buf, *argv); 97 strcpy(buf, *argv);
98 status = stat(buf, &statBuf); 98 status = stat(buf, &statBuf);
99 if (parentFlag == FALSE && status != -1 && errno != ENOENT) { 99 if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
100 fprintf(stderr, "%s: File exists\n", buf); 100 errorMsg("%s: File exists\n", buf);
101 exit FALSE; 101 exit FALSE;
102 } 102 }
103 if (parentFlag == TRUE) { 103 if (parentFlag == TRUE) {
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index c88f42cf5..4edb9b6b3 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -40,7 +40,7 @@ extern int rmdir_main(int argc, char **argv)
40 40
41 while (--argc > 0) { 41 while (--argc > 0) {
42 if (rmdir(*(++argv)) == -1) { 42 if (rmdir(*(++argv)) == -1) {
43 fprintf(stderr, "%s: %s\n", applet_name, strerror(errno)); 43 errorMsg("%s\n", strerror(errno));
44 exit(FALSE); 44 exit(FALSE);
45 } 45 }
46 } 46 }
diff --git a/coreutils/sort.c b/coreutils/sort.c
index a28122d51..c754989ea 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -263,7 +263,7 @@ int sort_main(int argc, char **argv)
263 break; 263 break;
264#endif 264#endif
265 default: 265 default:
266 fprintf(stderr, "sort: invalid option -- %c\n", opt); 266 errorMsg("invalid option -- %c\n", opt);
267 usage(sort_usage); 267 usage(sort_usage);
268 } 268 }
269 } else { 269 } else {
@@ -304,4 +304,4 @@ int sort_main(int argc, char **argv)
304 return(0); 304 return(0);
305} 305}
306 306
307/* $Id: sort.c,v 1.18 2000/06/28 22:15:26 markw Exp $ */ 307/* $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 3189d204f..601f0873d 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -375,7 +375,7 @@ extern int tail_main(int argc, char **argv)
375 usage(tail_usage); 375 usage(tail_usage);
376 default: 376 default:
377 if ((n_units = atoi(&argv[i][1])) < 1) { 377 if ((n_units = atoi(&argv[i][1])) < 1) {
378 fprintf(stderr, "tail: invalid option -- %c\n", opt); 378 errorMsg("invalid option -- %c\n", opt);
379 usage(tail_usage); 379 usage(tail_usage);
380 } 380 }
381 } 381 }
@@ -386,8 +386,7 @@ extern int tail_main(int argc, char **argv)
386 386
387 if (i + 1 < argc) { 387 if (i + 1 < argc) {
388 if (forever) { 388 if (forever) {
389 fprintf(stderr, 389 errorMsg("option -f is invalid with multiple files\n");
390 "tail: option -f is invalid with multiple files\n");
391 usage(tail_usage); 390 usage(tail_usage);
392 } 391 }
393 print_headers = 1; 392 print_headers = 1;
diff --git a/coreutils/tee.c b/coreutils/tee.c
index c9b5410d3..67b42a24d 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -104,7 +104,7 @@ int tee_main(int argc, char **argv)
104 /* init FILE pointers */ 104 /* init FILE pointers */
105 FileList = calloc(FL_MAX, sizeof(FILE*)); 105 FileList = calloc(FL_MAX, sizeof(FILE*));
106 if (!FileList) { 106 if (!FileList) {
107 fprintf(stderr, "tee: %s\n", strerror(errno)); 107 errorMsg("%s\n", strerror(errno));
108 exit(1); 108 exit(1);
109 } 109 }
110 FL_end = 0; 110 FL_end = 0;
@@ -133,4 +133,4 @@ int tee_main(int argc, char **argv)
133 return(0); 133 return(0);
134} 134}
135 135
136/* $Id: tee.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */ 136/* $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 64acf046a..16b257670 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -127,11 +127,11 @@ set_file_pointers(int schema, FILE ** in, FILE ** out, char **argv)
127 break; 127 break;
128 } 128 }
129 if (*in == NULL) { 129 if (*in == NULL) {
130 fprintf(stderr, "uniq: %s: %s\n", argv[0], strerror(errno)); 130 errorMsg("%s: %s\n", argv[0], strerror(errno));
131 return errno; 131 return errno;
132 } 132 }
133 if (*out == NULL) { 133 if (*out == NULL) {
134 fprintf(stderr, "uniq: %s: %s\n", argv[1], strerror(errno)); 134 errorMsg("%s: %s\n", argv[1], strerror(errno));
135 return errno; 135 return errno;
136 } 136 }
137 return 0; 137 return 0;
@@ -187,4 +187,4 @@ int uniq_main(int argc, char **argv)
187 return(0); 187 return(0);
188} 188}
189 189
190/* $Id: uniq.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */ 190/* $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 983c6725d..01dff81f9 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -43,7 +43,6 @@ extern int whoami_main(int argc, char **argv)
43 puts(user); 43 puts(user);
44 exit(TRUE); 44 exit(TRUE);
45 } 45 }
46 fprintf(stderr, "%s: cannot find username for UID %u\n", applet_name, 46 errorMsg("cannot find username for UID %u\n", (unsigned) uid);
47 (unsigned) uid);
48 return(FALSE); 47 return(FALSE);
49} 48}