shithub: neatroff

Download patch

ref: e61f5bacd5e58f10b6d597466937d92b09c18ed8
parent: 823c03a103b26313b269816e689ba38c81ef6d40
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Jul 4 07:59:20 EDT 2014

tr: clean up macrobody()

--- a/tr.c
+++ b/tr.c
@@ -135,23 +135,21 @@
 			sbuf_add(sbuf, c);
 		first = 0;
 		if (c == '\n') {
-			c = cp_next();
-			if (c == '.') {
-				read_regname(buf);
-				if ((n_cp && end[0] == buf[0] && end[1] == buf[1]) ||
-							!strcmp(end, buf)) {
-					jmp_eol();
-					break;
-				}
-				if (!sbuf)
-					continue;
+			if ((c = cp_next()) != '.') {
+				cp_back(c);
+				continue;
+			}
+			read_regname(buf);
+			if ((n_cp && end[0] == buf[0] && end[1] == buf[1]) ||
+						!strcmp(end, buf)) {
+				jmp_eol();
+				break;
+			}
+			if (sbuf) {
 				sbuf_add(sbuf, '.');
 				for (i = 0; buf[i]; i++)
 					sbuf_add(sbuf, (unsigned char) buf[i]);
-				continue;
 			}
-			if (sbuf && c >= 0)
-				sbuf_add(sbuf, c);
 		}
 	}
 	cp_copymode(0);