Patch from vodz to support 'tr a-z A-Z' syntax.
This commit is contained in:
parent
f52947ba71
commit
5a4a46a251
16
Changelog
16
Changelog
@ -1,3 +1,19 @@
|
|||||||
|
0.53pre
|
||||||
|
|
||||||
|
Critical Bugfixes:
|
||||||
|
* None yet
|
||||||
|
|
||||||
|
New Applets:
|
||||||
|
* None yet
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
* Vladimir Oleynik -- Fixed tr to support 'tr a-z A-Z' syntax.
|
||||||
|
|
||||||
|
|
||||||
|
-Not Yet Released
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
0.52
|
0.52
|
||||||
|
|
||||||
Critical Bugfixes:
|
Critical Bugfixes:
|
||||||
|
@ -54,7 +54,7 @@ static void convert()
|
|||||||
if (in_index == read_chars) {
|
if (in_index == read_chars) {
|
||||||
if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
|
if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
|
||||||
if (write(1, (char *) poutput, out_index) != out_index)
|
if (write(1, (char *) poutput, out_index) != out_index)
|
||||||
write(2, write_error, strlen(write_error));
|
error_msg("%s", write_error);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
in_index = 0;
|
in_index = 0;
|
||||||
@ -67,10 +67,8 @@ static void convert()
|
|||||||
continue;
|
continue;
|
||||||
poutput[out_index++] = last = coded;
|
poutput[out_index++] = last = coded;
|
||||||
if (out_index == BUFSIZ) {
|
if (out_index == BUFSIZ) {
|
||||||
if (write(1, (char *) poutput, out_index) != out_index) {
|
if (write(1, (char *) poutput, out_index) != out_index)
|
||||||
write(2, write_error, strlen(write_error));
|
error_msg_and_die("%s", write_error);
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
out_index = 0;
|
out_index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,6 +103,16 @@ static unsigned int expand(const char *arg, register unsigned char *buffer)
|
|||||||
if (*arg == '\\') {
|
if (*arg == '\\') {
|
||||||
arg++;
|
arg++;
|
||||||
*buffer++ = process_escape_sequence(&arg);
|
*buffer++ = process_escape_sequence(&arg);
|
||||||
|
} else if (*(arg+1) == '-') {
|
||||||
|
ac = *(arg+2);
|
||||||
|
if(ac == 0) {
|
||||||
|
*buffer++ = *arg++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
i = *arg;
|
||||||
|
while (i <= ac)
|
||||||
|
*buffer++ = i++;
|
||||||
|
arg += 3; /* Skip the assumed a-z */
|
||||||
} else if (*arg == '[') {
|
} else if (*arg == '[') {
|
||||||
arg++;
|
arg++;
|
||||||
i = *arg++;
|
i = *arg++;
|
||||||
|
18
tr.c
18
tr.c
@ -54,7 +54,7 @@ static void convert()
|
|||||||
if (in_index == read_chars) {
|
if (in_index == read_chars) {
|
||||||
if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
|
if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
|
||||||
if (write(1, (char *) poutput, out_index) != out_index)
|
if (write(1, (char *) poutput, out_index) != out_index)
|
||||||
write(2, write_error, strlen(write_error));
|
error_msg("%s", write_error);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
in_index = 0;
|
in_index = 0;
|
||||||
@ -67,10 +67,8 @@ static void convert()
|
|||||||
continue;
|
continue;
|
||||||
poutput[out_index++] = last = coded;
|
poutput[out_index++] = last = coded;
|
||||||
if (out_index == BUFSIZ) {
|
if (out_index == BUFSIZ) {
|
||||||
if (write(1, (char *) poutput, out_index) != out_index) {
|
if (write(1, (char *) poutput, out_index) != out_index)
|
||||||
write(2, write_error, strlen(write_error));
|
error_msg_and_die("%s", write_error);
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
out_index = 0;
|
out_index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,6 +103,16 @@ static unsigned int expand(const char *arg, register unsigned char *buffer)
|
|||||||
if (*arg == '\\') {
|
if (*arg == '\\') {
|
||||||
arg++;
|
arg++;
|
||||||
*buffer++ = process_escape_sequence(&arg);
|
*buffer++ = process_escape_sequence(&arg);
|
||||||
|
} else if (*(arg+1) == '-') {
|
||||||
|
ac = *(arg+2);
|
||||||
|
if(ac == 0) {
|
||||||
|
*buffer++ = *arg++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
i = *arg;
|
||||||
|
while (i <= ac)
|
||||||
|
*buffer++ = i++;
|
||||||
|
arg += 3; /* Skip the assumed a-z */
|
||||||
} else if (*arg == '[') {
|
} else if (*arg == '[') {
|
||||||
arg++;
|
arg++;
|
||||||
i = *arg++;
|
i = *arg++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user