summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-09-18 09:08:03 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-09-18 09:08:03 -0700
commitf05a3ac70b1789550e03a2d2e68a24cc03affe36 (patch)
tree949491cf0f702e95d626c35f69c3a3080570adde
parentb7895d8ec2e29e7f4e5b1cd4519fb56397523b8a (diff)
downloadman-f05a3ac70b1789550e03a2d2e68a24cc03affe36.tar.gz
man-f05a3ac70b1789550e03a2d2e68a24cc03affe36.tar.bz2
man-f05a3ac70b1789550e03a2d2e68a24cc03affe36.zip
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.
-rw-r--r--man2html/man2html.c5
1 files changed, 1 insertions, 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);