Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tr Fix another bug, relating to parsing the [=x=] sy...
details: https://anonhg.NetBSD.org/src/rev/51d14df5e329
branches: trunk
changeset: 789204:51d14df5e329
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Aug 11 01:49:40 2013 +0000
description:
Fix another bug, relating to parsing the [=x=] syntax.
diffstat:
usr.bin/tr/str.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diffs (53 lines):
diff -r 06a60389aa92 -r 51d14df5e329 usr.bin/tr/str.c
--- a/usr.bin/tr/str.c Sun Aug 11 01:42:35 2013 +0000
+++ b/usr.bin/tr/str.c Sun Aug 11 01:49:40 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.27 2013/08/11 01:42:35 dholland Exp $ */
+/* $NetBSD: str.c,v 1.28 2013/08/11 01:49:40 dholland Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95";
#endif
-__RCSID("$NetBSD: str.c,v 1.27 2013/08/11 01:42:35 dholland Exp $");
+__RCSID("$NetBSD: str.c,v 1.28 2013/08/11 01:49:40 dholland Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -196,6 +196,7 @@
return 0;
s->str += 2;
genequiv(s);
+ s->str = p + 2;
return 1;
default: /* "[\###*n]" or "[#*n]" */
if ((p = strpbrk(s->str + 2, "*]")) == NULL)
@@ -310,16 +311,19 @@
ch = (unsigned char)s->str[0];
if (ch == '\\') {
s->equiv[0] = backslash(s);
- if (*s->str != '=') {
- errx(1, "Misplaced equivalence equals sign");
- }
} else {
s->equiv[0] = ch;
- if (s->str[1] != '=') {
- errx(1, "Misplaced equivalence equals sign");
- }
+ s->str++;
+ }
+ if (s->str[0] != '=') {
+ errx(1, "Misplaced equivalence equals sign");
}
- s->str += 2;
+ s->str++;
+ if (s->str[0] != ']') {
+ errx(1, "Misplaced equivalence right bracket");
+ }
+ s->str++;
+
s->cnt = 0;
s->state = SET;
s->set = s->equiv;
Home |
Main Index |
Thread Index |
Old Index