diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-07-05 17:26:35 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-07-05 17:26:35 +0000 |
commit | f7cf2f7ef98077c59e4da4bc25de38c22174ac9d (patch) | |
tree | a2fa5e67df2ccd2881a21ed4d22c6f7453b793b2 /tr.c | |
parent | 57ebebfb01a9a29378b2f0179724661bfc5402e9 (diff) |
* Fix to tr so it recognizes standard escape sequences. Merged common
escape seq. code from tr and echo into utility.c. Fix thanks to
Matt Kraai <kraai@alumni.carnegiemellon.edu>.
* This should close Bug #1015. Please test.
-Erik
Diffstat (limited to 'tr.c')
-rw-r--r-- | tr.c | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -111,22 +111,14 @@ static void map(register unsigned char *string1, register unsigned char *string2 } } -static void expand(register char *arg, register unsigned char *buffer) +static void expand(char *arg, register unsigned char *buffer) { int i, ac; while (*arg) { if (*arg == '\\') { arg++; - i = ac = 0; - if (*arg >= '0' && *arg <= '7') { - do { - ac = (ac << 3) + *arg++ - '0'; - i++; - } while (i < 4 && *arg >= '0' && *arg <= '7'); - *buffer++ = ac; - } else if (*arg != '\0') - *buffer++ = *arg++; + *buffer++ = process_escape_sequence(&arg); } else if (*arg == '[') { arg++; i = *arg++; |