have to increment on octal string; bug case was fo tr '\003' '\002',
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 22 Nov 1991 04:15:26 +0000 (20:15 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 22 Nov 1991 04:15:26 +0000 (20:15 -0800)
occurrences of '3' in the string would get changed to '2'

SCCS-vsn: usr.bin/tr/str.c 5.4

usr/src/usr.bin/tr/str.c

index 8b3e2c3..d9350dd 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)str.c      5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)str.c      5.4 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/cdefs.h>
 #endif /* not lint */
 
 #include <sys/cdefs.h>
@@ -286,9 +286,9 @@ backslash(s)
                if (++cnt == 3)
                        break;
        }
                if (++cnt == 3)
                        break;
        }
+       ++s->str;
        if (cnt)
                return (val);
        if (cnt)
                return (val);
-       ++s->str;
        switch (ch) {
                case 'a':                       /* escape characters */
                        return ('\7');
        switch (ch) {
                case 'a':                       /* escape characters */
                        return ('\7');