From f05a3ac70b1789550e03a2d2e68a24cc03affe36 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 18 Sep 2014 09:08:03 -0700 Subject: Fix breakage in if, else and while. The if/ie and else constructs must not destructively manipulate the program source, since they can be involved in iteration; removing the dubious assignment to c[-1] and *c. The ifelseval variable should not be touched by while. The ifelseval variable should be set at the last possible moment by ie, because of nesting: the antecedent clause processed by ie could itself clobber the variable. --- man2html/man2html.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/man2html/man2html.c b/man2html/man2html.c index 642847c..68bb4d0 100644 --- a/man2html/man2html.c +++ b/man2html/man2html.c @@ -1826,7 +1826,6 @@ scan_request(char *c) { /* .el anything : else part of if else */ if (ifelseval) { c=c+j; - c[-1]='\n'; c=scan_troff(c,1,NULL); } else c=skip_till_newline(c+j); @@ -1843,13 +1842,12 @@ scan_request(char *c) { */ c=c+j; c=scan_expression(c, &i); - ifelseval=!i; if (i) { - *c='\n'; c++; c=scan_troff(c,1,NULL); } else c=skip_till_newline(c); + ifelseval=!i; break; case V4('w','h','i','l'): /* groff extension @@ -1866,7 +1864,6 @@ scan_request(char *c) { for (;;) { c=saved_c+j; c=scan_expression(c, &i); - ifelseval=!i; if (i) { c++; (void) scan_troff(c,1,NULL); -- cgit v1.2.3