aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-05-19 05:35:19 +0000
committerErik Andersen <andersen@codepoet.org>2000-05-19 05:35:19 +0000
commit330fd2b5767110f29544131d4c72c77e0506b6df (patch)
treeaa360774a903d3ebb0b2b5f3031c2e359f9c3afb /coreutils
parentd356c6e9d1bc091c64200ecc401aa9b6ffb53151 (diff)
downloadbusybox-w32-330fd2b5767110f29544131d4c72c77e0506b6df.tar.gz
busybox-w32-330fd2b5767110f29544131d4c72c77e0506b6df.tar.bz2
busybox-w32-330fd2b5767110f29544131d4c72c77e0506b6df.zip
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 10ae76188..78265a5e6 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -24,19 +24,23 @@
24#include "internal.h" 24#include "internal.h"
25#include <stdio.h> 25#include <stdio.h>
26 26
27const char *basename_usage="basename FILE [SUFFIX]\n"
28#ifndef BB_FEATURE_TRIVIAL_HELP
29 "\nStrips directory path and suffixes from FILE.\n"
30 "If specified, also removes any trailing SUFFIX.\n"
31#endif
32;
33
34
27extern int basename_main(int argc, char **argv) 35extern int basename_main(int argc, char **argv)
28{ 36{
29 int m, n; 37 int m, n;
30 char *s, *s1; 38 char *s, *s1;
31 39
32 if ((argc < 2) || (**(argv + 1) == '-')) { 40 if ((argc < 2) || (**(argv + 1) == '-')) {
33 usage("basename FILE [SUFFIX]\n" 41 usage(basename_usage);
34#ifndef BB_FEATURE_TRIVIAL_HELP
35 "\nStrips directory path and suffixes from FILE.\n"
36 "If specified, also removes any trailing SUFFIX.\n"
37#endif
38 );
39 } 42 }
43
40 argv++; 44 argv++;
41 45
42 s1=*argv+strlen(*argv)-1; 46 s1=*argv+strlen(*argv)-1;
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 28a011dcd..4e9a94049 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -51,7 +51,6 @@
51#include <unistd.h> 51#include <unistd.h>
52#include <stdio.h> 52#include <stdio.h>
53#include <sys/types.h> 53#include <sys/types.h>
54#include <getopt.h>
55#include <sys/stat.h> 54#include <sys/stat.h>
56#include <string.h> 55#include <string.h>
57#include <errno.h> 56#include <errno.h>
diff --git a/coreutils/tr.c b/coreutils/tr.c
index ebb64799f..3e7ba583c 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -30,6 +30,20 @@
30#include <stdlib.h> 30#include <stdlib.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <sys/types.h> 32#include <sys/types.h>
33#define BB_DECLARE_EXTERN
34#define bb_need_write_error
35#include "messages.c"
36
37const char *tr_usage="tr [-cds] STRING1 [STRING2]\n"
38#ifndef BB_FEATURE_TRIVIAL_HELP
39 "\nTranslate, squeeze, and/or delete characters from\n"
40 "standard input, writing to standard output.\n\n"
41 "Options:\n"
42 "\t-c\ttake complement of STRING1\n"
43 "\t-d\tdelete input characters coded STRING1\n"
44 "\t-s\tsqueeze multiple output characters of STRING2 into one character\n"
45#endif
46;
33 47
34 48
35 49
@@ -60,7 +74,7 @@ static void convert()
60 if (in_index == read_chars) { 74 if (in_index == read_chars) {
61 if ((read_chars = read(0, (char *) input, BUFSIZ)) <= 0) { 75 if ((read_chars = read(0, (char *) input, BUFSIZ)) <= 0) {
62 if (write(1, (char *) output, out_index) != out_index) 76 if (write(1, (char *) output, out_index) != out_index)
63 write(2, "Bad write\n", 10); 77 write(2, write_error, strlen(write_error));
64 exit(0); 78 exit(0);
65 } 79 }
66 in_index = 0; 80 in_index = 0;
@@ -74,7 +88,7 @@ static void convert()
74 output[out_index++] = last = coded; 88 output[out_index++] = last = coded;
75 if (out_index == BUFSIZ) { 89 if (out_index == BUFSIZ) {
76 if (write(1, (char *) output, out_index) != out_index) { 90 if (write(1, (char *) output, out_index) != out_index) {
77 write(2, "Bad write\n", 10); 91 write(2, write_error, strlen(write_error));
78 exit(1); 92 exit(1);
79 } 93 }
80 out_index = 0; 94 out_index = 0;
@@ -167,16 +181,7 @@ extern int tr_main(int argc, char **argv)
167 sq_fl = TRUE; 181 sq_fl = TRUE;
168 break; 182 break;
169 default: 183 default:
170 usage("tr [-cds] STRING1 [STRING2]\n" 184 usage(tr_usage);
171#ifndef BB_FEATURE_TRIVIAL_HELP
172 "\nTranslate, squeeze, and/or delete characters from\n"
173 "standard input, writing to standard output.\n\n"
174 "Options:\n"
175 "\t-c\ttake complement of STRING1\n"
176 "\t-d\tdelete input characters coded STRING1\n"
177 "\t-s\tsqueeze multiple output characters of STRING2 into one character\n"
178#endif
179 );
180 } 185 }
181 } 186 }
182 index++; 187 index++;