shithub: neatroff

Download patch

ref: c6e989fa2ac98bb2db4c1419428ab8e655fcfd7b
parent: 80c5fe62c753e8d547d7f1a171b502ff08558ca6
author: Ali Gholami Rudi <[email protected]>
date: Tue Dec 30 13:09:03 EST 2014

char: expect ascii character names in \x or \(xy

Now neatroff expects x and xy to be ASCII characters in \x or \(xy,
\nx or \n(xy, and \*x or \*(xy.  UTF-8 character or register names can
be accessed with \[xyz], \n[xyz], or \*[xyz].

--- a/char.c
+++ b/char.c
@@ -114,14 +114,16 @@
 	if (!utf8next(c, next))
 		return -1;
 	if (c[0] == c_ni) {
-		utf8next(c + 1, next);
+		c[1] = next();
+		c[2] = '\0';
 		return c_ni;
 	}
 	if (c[0] == c_ec) {
-		utf8next(c + 1, next);
+		c[1] = next();
+		c[2] = '\0';
 		if (c[1] == '(') {
-			l = utf8next(c, next);
-			l += utf8next(c + l, next);
+			c[0] = next();
+			c[1] = next();
 			return '(';
 		} else if (!n_cp && c[1] == '[') {
 			l = 0;
@@ -232,10 +234,11 @@
 		return -1;
 	utf8read(s, d);
 	if (d[0] == c_ec) {
-		utf8read(s, d + 1);
+		d[1] = *(*s)++;
+		d[2] = '\0';
 		if (d[1] == '(') {
-			utf8read(s, d);
-			utf8read(s, d + strlen(d));
+			d[0] = *(*s)++;
+			d[1] = *(*s)++;
 		} else if (!n_cp && d[1] == '[') {
 			while (**s && **s != ']')
 				*r++ = *(*s)++;