shithub: neatroff

Download patch

ref: 9c58dba3438cbf2497178b45a7f4c7cdc001a7f0
parent: b034c0bb63e8aa719118cb79323e6732fe728465
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sun Feb 21 07:10:04 EST 2021

tr: preserve autoincrement, if the third argument of .nr is missing

Reported and tested by Meino Cramer <mylists@posteo.de>.

--- a/tr.c
+++ b/tr.c
@@ -49,7 +49,8 @@
 		return;
 	id = map(args[1]);
 	num_set(id, eval_re(args[2], num_get(id), 'u'));
-	num_setinc(id, args[3] ? eval(args[3], 'u') : 0);
+	if (args[3])
+		num_setinc(id, eval(args[3], 'u'));
 }
 
 static void tr_rr(char **args)