shithub: neatroff

Download patch

ref: 7c5d06769f410308200363047b14039c5dbe387d
parent: e8bec45dfe627c52384a65f856d00bcc0de454dc
author: Ali Gholami Rudi <[email protected]>
date: Tue Apr 23 13:11:16 EDT 2013

ren: ignore multiple .bp requests before a new page

--- a/ren.c
+++ b/ren.c
@@ -142,10 +142,10 @@
 static int trap_reg(int pos);
 static int trap_pos(int pos);
 
-static void push_ne(int dobr)
+static void push_ne(void)
 {
 	char buf[32];
-	sprintf(buf, "%s.ne %du\n", dobr ? ".br\n" : "", n_p);
+	sprintf(buf, ".ne %du\n", n_p);
 	in_pushnl(buf, NULL);
 }
 
@@ -152,7 +152,7 @@
 static void trap_exec(int reg)
 {
 	if (bp_force)
-		push_ne(0);
+		push_ne();
 	if (str_get(reg))
 		in_pushnl(str_get(reg), NULL);
 }
@@ -316,10 +316,13 @@
 void tr_bp(char **args)
 {
 	if (!cdiv && (args[1] || !n_ns)) {
+		if (!bp_force)
+			push_ne();
+		if (args[0][0] == '.')
+			in_pushnl(".br\n", NULL);
 		bp_force = 1;
 		if (args[1])
 			bp_next = eval(args[1], n_pg, 0);
-		push_ne(args[0][0] == '.');
 	}
 }