aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-07-09 21:32:29 +0000
committerEric Andersen <andersen@codepoet.org>2001-07-09 21:32:29 +0000
commit5a4a46a2519af1e79d931a856ee1a3b70e60d168 (patch)
tree8984e4a7c0db121de64ca8de078a0d3ff13dba6e
parentf52947ba71cafc771a5858ee2347f31e724376fc (diff)
downloadbusybox-w32-5a4a46a2519af1e79d931a856ee1a3b70e60d168.tar.gz
busybox-w32-5a4a46a2519af1e79d931a856ee1a3b70e60d168.tar.bz2
busybox-w32-5a4a46a2519af1e79d931a856ee1a3b70e60d168.zip
Patch from vodz to support 'tr a-z A-Z' syntax.
-rw-r--r--Changelog16
-rw-r--r--coreutils/tr.c18
-rw-r--r--tr.c18
3 files changed, 42 insertions, 10 deletions
diff --git a/Changelog b/Changelog
index 0a06a0a05..90b767d81 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,19 @@
10.53pre
2
3 Critical Bugfixes:
4 * None yet
5
6 New Applets:
7 * None yet
8
9 Other Changes:
10 * Vladimir Oleynik -- Fixed tr to support 'tr a-z A-Z' syntax.
11
12
13 -Not Yet Released
14
15
16
10.52 170.52
2 18
3 Critical Bugfixes: 19 Critical Bugfixes:
diff --git a/coreutils/tr.c b/coreutils/tr.c
index a5d068262..5b7b8d091 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -54,7 +54,7 @@ static void convert()
54 if (in_index == read_chars) { 54 if (in_index == read_chars) {
55 if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) { 55 if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
56 if (write(1, (char *) poutput, out_index) != out_index) 56 if (write(1, (char *) poutput, out_index) != out_index)
57 write(2, write_error, strlen(write_error)); 57 error_msg("%s", write_error);
58 exit(0); 58 exit(0);
59 } 59 }
60 in_index = 0; 60 in_index = 0;
@@ -67,10 +67,8 @@ static void convert()
67 continue; 67 continue;
68 poutput[out_index++] = last = coded; 68 poutput[out_index++] = last = coded;
69 if (out_index == BUFSIZ) { 69 if (out_index == BUFSIZ) {
70 if (write(1, (char *) poutput, out_index) != out_index) { 70 if (write(1, (char *) poutput, out_index) != out_index)
71 write(2, write_error, strlen(write_error)); 71 error_msg_and_die("%s", write_error);
72 exit(1);
73 }
74 out_index = 0; 72 out_index = 0;
75 } 73 }
76 } 74 }
@@ -105,6 +103,16 @@ static unsigned int expand(const char *arg, register unsigned char *buffer)
105 if (*arg == '\\') { 103 if (*arg == '\\') {
106 arg++; 104 arg++;
107 *buffer++ = process_escape_sequence(&arg); 105 *buffer++ = process_escape_sequence(&arg);
106 } else if (*(arg+1) == '-') {
107 ac = *(arg+2);
108 if(ac == 0) {
109 *buffer++ = *arg++;
110 continue;
111 }
112 i = *arg;
113 while (i <= ac)
114 *buffer++ = i++;
115 arg += 3; /* Skip the assumed a-z */
108 } else if (*arg == '[') { 116 } else if (*arg == '[') {
109 arg++; 117 arg++;
110 i = *arg++; 118 i = *arg++;
diff --git a/tr.c b/tr.c
index a5d068262..5b7b8d091 100644
--- a/tr.c
+++ b/tr.c
@@ -54,7 +54,7 @@ static void convert()
54 if (in_index == read_chars) { 54 if (in_index == read_chars) {
55 if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) { 55 if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
56 if (write(1, (char *) poutput, out_index) != out_index) 56 if (write(1, (char *) poutput, out_index) != out_index)
57 write(2, write_error, strlen(write_error)); 57 error_msg("%s", write_error);
58 exit(0); 58 exit(0);
59 } 59 }
60 in_index = 0; 60 in_index = 0;
@@ -67,10 +67,8 @@ static void convert()
67 continue; 67 continue;
68 poutput[out_index++] = last = coded; 68 poutput[out_index++] = last = coded;
69 if (out_index == BUFSIZ) { 69 if (out_index == BUFSIZ) {
70 if (write(1, (char *) poutput, out_index) != out_index) { 70 if (write(1, (char *) poutput, out_index) != out_index)
71 write(2, write_error, strlen(write_error)); 71 error_msg_and_die("%s", write_error);
72 exit(1);
73 }
74 out_index = 0; 72 out_index = 0;
75 } 73 }
76 } 74 }
@@ -105,6 +103,16 @@ static unsigned int expand(const char *arg, register unsigned char *buffer)
105 if (*arg == '\\') { 103 if (*arg == '\\') {
106 arg++; 104 arg++;
107 *buffer++ = process_escape_sequence(&arg); 105 *buffer++ = process_escape_sequence(&arg);
106 } else if (*(arg+1) == '-') {
107 ac = *(arg+2);
108 if(ac == 0) {
109 *buffer++ = *arg++;
110 continue;
111 }
112 i = *arg;
113 while (i <= ac)
114 *buffer++ = i++;
115 arg += 3; /* Skip the assumed a-z */
108 } else if (*arg == '[') { 116 } else if (*arg == '[') {
109 arg++; 117 arg++;
110 i = *arg++; 118 i = *arg++;