summaryrefslogtreecommitdiff
path: root/coreutils/tr.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/tr.c')
-rw-r--r--coreutils/tr.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c
index c0d0dfacb..594571833 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -51,11 +51,10 @@ static unsigned int expand(const char *arg, char *buffer)
51 char *buffer_start = buffer; 51 char *buffer_start = buffer;
52 unsigned i; /* XXX: FIXME: use unsigned char? */ 52 unsigned i; /* XXX: FIXME: use unsigned char? */
53 unsigned char ac; 53 unsigned char ac;
54#define CLO ":]" 54#define CLO ":]\0"
55 static const char * const classes[] = { 55 static const char classes[] =
56 "alpha"CLO, "alnum"CLO, "digit"CLO, "lower"CLO, "upper"CLO, "space"CLO, 56 "alpha"CLO "alnum"CLO "digit"CLO "lower"CLO "upper"CLO "space"CLO
57 "blank"CLO, "punct"CLO, "cntrl"CLO, NULL 57 "blank"CLO "punct"CLO "cntrl"CLO;
58 };
59#define CLASS_invalid 0 /* we increment the retval */ 58#define CLASS_invalid 0 /* we increment the retval */
60#define CLASS_alpha 1 59#define CLASS_alpha 1
61#define CLASS_alnum 2 60#define CLASS_alnum 2
@@ -90,7 +89,7 @@ static unsigned int expand(const char *arg, char *buffer)
90 smalluint j; 89 smalluint j;
91 { /* not really pretty.. */ 90 { /* not really pretty.. */
92 char *tmp = xstrndup(arg, 7); // warning: xdigit needs 8, not 7 91 char *tmp = xstrndup(arg, 7); // warning: xdigit needs 8, not 7
93 j = index_in_str_array(classes, tmp) + 1; 92 j = index_in_strings(classes, tmp) + 1;
94 free(tmp); 93 free(tmp);
95 } 94 }
96 if (j == CLASS_alnum || j == CLASS_digit) { 95 if (j == CLASS_alnum || j == CLASS_digit) {