🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.usg
Article #28

Bug in S3 "nroff" and "-me" macros

#28
From: Guy Harris
Date: Fri, 23 Dec 1983 05:23
40 lines
2077 bytes
There is a bug in the System III "nroff" which causes the Berkeley "-me"
macros not to work (the bug seems to be fixed in the System V "nroff").
If you write something like:

	.if <condition> \
	.	do something

the V7 "nroff" accepted this (i.e., the "do something" was done only if the
<condition> was true) but the S3 "nroff" did the "do something" regardless.
The reason was that the code for ".if" that skips over text was redone in
S3 so that the text would be gobbled with "getch0()" (which doesn't do much
except read characters) as opposed to "getch()" (which expands number registers,
including autoincrement/decrement, etc. which means that you get screwed
if you really expected the autoincrement/decrement not to occur if the
condition was false).  (This fix is mentioned in the addendum to the "nroff"
manual in the S3 documentation.)  Unfortunately, using "getch0()" also turns
off the handling of "\<new-line>", so it eats the "\" at the end of the line
and stops.  The fix is to change the lines in "eatblk" in n5.c that read:

		if (i == ESC) cnt++;
		    else if (cnt == 1)
			     if (i == '{') i = LEFT;
				 else if (i == '}') i = RIGHT;
					  else cnt = 0;
			     else cnt = 0;

to:

		if (i == ESC) cnt++;
		    else if (cnt == 1)	{
			     if (i == '{') i = LEFT;
				 else if (i == '}') i = RIGHT;
					  else if (i == '\n') i = 0;
			     cnt = 0;	}

which also fixes a problem where "cnt" was left non-zero after a \{ or a
\} was seen.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy
Technical Details
Message-ID: <1498@rlgvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!floyd!harpo!seismo!rlgvax!guy

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!floyd!harpo!seismo!rlgvax!guy
From: guy@rlgvax.UUCP (Guy Harris)
Newsgroups: net.bugs.usg
Subject: Bug in S3 "nroff" and "-me" macros
Message-ID: <1498@rlgvax.UUCP>
Date: Fri, 23-Dec-83 00:23:25 EST
Article-I.D.: rlgvax.1498
Posted: Fri Dec 23 00:23:25 1983
Date-Received: Sat, 24-Dec-83 10:39:49 EST
Organization: CCI Office Systems Group, Reston, VA
Lines: 40