]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/tr.c
fix ref822 again: remove uniqarray(), fix case with many entries in 'n'.
[plan9front.git] / sys / src / cmd / tr.c
index da6fedf5f603f8ac8498dd85512642cddc60ecc8..63532a4ab286e6a8c5fa74eebdf538d99d095995 100644 (file)
@@ -15,10 +15,8 @@ uchar        bits[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
 #define        CLEARBIT(a,c)           ((a)[(c)/8] &= ~bits[(c)&07])
 #define        BITSET(a,c)             ((a)[(c)/8] & bits[(c)&07])
 
-#define        MAXRUNE 0xFFFF
-
-uchar  f[(MAXRUNE+1)/8];
-uchar  t[(MAXRUNE+1)/8];
+uchar  f[(Runemax+1)/8];
+uchar  t[(Runemax+1)/8];
 char   wbuf[4096];
 char   *wptr;
 
@@ -94,7 +92,7 @@ delete(void)
                        SETBIT(t, c);
        }
 
-       last = 0x10000;
+       last = Runemax+1;
        while (readrune(0, &c) > 0) {
                if(!BITSET(f, c) && (c != last || !BITSET(t,c))) {
                        last = c;
@@ -134,7 +132,7 @@ complement(void)
                else p[i] = i;
        }
        if (sflag){
-               lastc = 0x10000;
+               lastc = Runemax+1;
                while (readrune(0, &from) > 0) {
                        if (from > high)
                                from = to;
@@ -188,7 +186,7 @@ translit(void)
                SETBIT(t,to);
        }
        if (sflag){
-               lastc = 0x10000;
+               lastc = Runemax+1;
                while (readrune(0, &from) > 0) {
                        if (from <= high)
                                from = p[from];