summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorErik Andersen2000-05-19 05:35:19 +0000
committerErik Andersen2000-05-19 05:35:19 +0000
commit330fd2b5767110f29544131d4c72c77e0506b6df (patch)
treeaa360774a903d3ebb0b2b5f3031c2e359f9c3afb /coreutils
parentd356c6e9d1bc091c64200ecc401aa9b6ffb53151 (diff)
downloadbusybox-330fd2b5767110f29544131d4c72c77e0506b6df.zip
busybox-330fd2b5767110f29544131d4c72c77e0506b6df.tar.gz
More libc portability updates, add in the website (which has not been
archived previously). Wrote 'which' during the meeting today. -Erik
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/basename.c16
-rw-r--r--coreutils/printf.c1
-rw-r--r--coreutils/tr.c29
3 files changed, 27 insertions, 19 deletions
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 10ae761..78265a5 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -24,19 +24,23 @@
#include "internal.h"
#include <stdio.h>
+const char *basename_usage="basename FILE [SUFFIX]\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nStrips directory path and suffixes from FILE.\n"
+ "If specified, also removes any trailing SUFFIX.\n"
+#endif
+;
+
+
extern int basename_main(int argc, char **argv)
{
int m, n;
char *s, *s1;
if ((argc < 2) || (**(argv + 1) == '-')) {
- usage("basename FILE [SUFFIX]\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
- "\nStrips directory path and suffixes from FILE.\n"
- "If specified, also removes any trailing SUFFIX.\n"
-#endif
- );
+ usage(basename_usage);
}
+
argv++;
s1=*argv+strlen(*argv)-1;
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 28a011d..4e9a940 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -51,7 +51,6 @@
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
-#include <getopt.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
diff --git a/coreutils/tr.c b/coreutils/tr.c
index ebb6479..3e7ba58 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -30,6 +30,20 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
+#define BB_DECLARE_EXTERN
+#define bb_need_write_error
+#include "messages.c"
+
+const char *tr_usage="tr [-cds] STRING1 [STRING2]\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nTranslate, squeeze, and/or delete characters from\n"
+ "standard input, writing to standard output.\n\n"
+ "Options:\n"
+ "\t-c\ttake complement of STRING1\n"
+ "\t-d\tdelete input characters coded STRING1\n"
+ "\t-s\tsqueeze multiple output characters of STRING2 into one character\n"
+#endif
+;
@@ -60,7 +74,7 @@ static void convert()
if (in_index == read_chars) {
if ((read_chars = read(0, (char *) input, BUFSIZ)) <= 0) {
if (write(1, (char *) output, out_index) != out_index)
- write(2, "Bad write\n", 10);
+ write(2, write_error, strlen(write_error));
exit(0);
}
in_index = 0;
@@ -74,7 +88,7 @@ static void convert()
output[out_index++] = last = coded;
if (out_index == BUFSIZ) {
if (write(1, (char *) output, out_index) != out_index) {
- write(2, "Bad write\n", 10);
+ write(2, write_error, strlen(write_error));
exit(1);
}
out_index = 0;
@@ -167,16 +181,7 @@ extern int tr_main(int argc, char **argv)
sq_fl = TRUE;
break;
default:
- usage("tr [-cds] STRING1 [STRING2]\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
- "\nTranslate, squeeze, and/or delete characters from\n"
- "standard input, writing to standard output.\n\n"
- "Options:\n"
- "\t-c\ttake complement of STRING1\n"
- "\t-d\tdelete input characters coded STRING1\n"
- "\t-s\tsqueeze multiple output characters of STRING2 into one character\n"
-#endif
- );
+ usage(tr_usage);
}
}
index++;