[net.unix-wizards] An oldie and a newie.

earle@smeagol.UUCP (Greg Earle) (12/18/85)

I'm sure this one is as old as the hills, but it's the first time I've ever
encountered it.

In Fred Fish's documentation for his 'DBUG' package, he included the source
for an -mm version of the User's Manual (He forgot to post the files that
are .so'd in there, but what the hell).  It .so's some small files, the
first bunch are short snatches of code.  Well, a coupla lines in these code
files have our old friend ``printf(" TEXT \n", args)''.  Along comes poor
old [nt]roff, which sees these "\n"'s and decides it's trying to tell it to
do something.  So it swallows the \n" whole, and puts out a 0, which looks
just lovely.  Trying to be clever, I thought a double \\ would do the trick,
but I guess when it is interpreting, [nt]roff just swallows the first \,
and decides to evaluate the remaining \n" as a number register; thus the
unwelcome "0".  I went to my moth eaten UNIX Programmer's Manual V 2B, and
tried framing the .so's with .eo (Escape char [\] off) and .ec (Set escape 
character on, \ if no argument).  This didn't work.  So, how do you get
"\n"s into an [nt]roff document without them being interpreted?

Here's a new one.  This really belongs in net.mail, but what the heck.
Has anyone out there had a problem with "sendmail" truncating a long 
list of system names before it sends the mail on to uux or a smart mailer?
I had my hacked version of the Georgia Tech "uumail" print out its argv[3] 
(the destination address) when the destination was 19 sites long, and it got
mangled!  Luckily I caught it and changed the UUCP file before it got sent
out the door.  Specifically, one site away from us replies to news articles
via the strict "From:" field (no smart mailer); we got in one of his replies
that was addressed such that it was supposed to 
'rmail 1!2!3!4!...!17!18!19!username'.  Our
sendmail decided to truncate this address to '1!2!3!4!...12!13!14!15'; 
therefore making the destination "user" machine 15, located at site #14 in 
the chain!  The destination address was truncated at 105 characters, which 
certainly seems like a strange number to me ...

----------
	Greg Earle
	JPL
	..!sdcrdcf!smeagol!earle
	ia-sun2!smeagol!earle@cit-vax.arpa

=> Know Your Culture <=
"PsychoCandy", LP by The Jesus and Mary Chain - available at more 
                                                discerning record
                                                stores everywhere ...

paul@vcvax1.UUCP (paul) (12/20/85)

> So, how do you get
> "\n"s into an [nt]roff document without them being interpreted?

The way to get a `\' in the output is to use a `\e' in the input.
So use `\en' to get `\n'.

fnf@unisoft.UUCP (12/20/85)

In article <525@smeagol.UUCP> earle@smeagol.UUCP (Greg Earle) writes:
>In Fred Fish's documentation for his 'DBUG' package, he included the source
>for an -mm version of the User's Manual (He forgot to post the files that
>are .so'd in there, but what the hell).  It .so's some small files ...

If you examine the workings of the makefile you will discover that the 
included files are created dynamically from the compilable examples
in such a way that nroff doesn't barf on them.  Sounds like you didn't
use the makefile (or did I actually screw up and forget to post some
pieces? :-).

-Fred

===========================================================================
Fred Fish    UniSoft Systems Inc, 739 Allston Way, Berkeley, CA  94710  USA
{ucbvax,dual}!unisoft!fnf	(415) 644 1230 		TWX 11 910 366-2145
===========================================================================

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (12/21/85)

If you leave \ as your escape character,
then \e will print as a backslash.

mark@umcp-cs.UUCP (Mark Weiser) (12/21/85)

In article <525@smeagol.UUCP> earle@smeagol.UUCP (Greg Earle) writes:
>... So, how do you get
>"\n"s into an [nt]roff document without them being interpreted?

Use \e in place of \.  Doubling \'s will sometimes not work because
each level of n/troff processing strips one off, and you can never tell
how many levels are happening because of macro preprocessing and so on.
\e is define to be the graphic representation of the escape character,
but is never itself treated as an escape.  So, for \n, use \en.
	-mark
-- 
Spoken: Mark Weiser 	ARPA:	mark@maryland	Phone: +1-301-454-7817
CSNet:	mark@umcp-cs 	UUCP:	{seismo,allegra}!umcp-cs!mark
USPS: Computer Science Dept., University of Maryland, College Park, MD 20742

kwan@smeagol.UUCP (Richard Kwan) (12/23/85)

In <525@smeagol.UUCP>, Greg Earle writes:
> So, how do you get
> "\n"s into an [nt]roff document without them being interpreted?

In <156@vcvax1.UUCP>, paul@vcvax1 response:
> The way to get a `\' in the output is to use a `\e' in the input.
> So use `\en' to get `\n'.

...as have many others.

Allow me to play dumb for a moment... (cause on this one, I really
am.)  All these responses seem to focus on useing "\e" to get a
literal "\".

1.  Why not use ".eo" or ".ec"?
2.  What effect would using ".eo" or ".ec" have on macros which
    [nt]roff has already read?
3.  What is the recommended way to include source code into a
    document?  (I assume we want to do nothing to it, if at all
    possible, i.e., just read it from the original file.)

		Rick Kwan

jsdy@hadron.UUCP (Joseph S. D. Yao) (12/29/85)

In article <530@smeagol.UUCP> kwan@smeagol.UUCP (Richard Kwan) writes:
>>In <525@smeagol.UUCP>, Greg Earle writes:
>>> So, how do you get
>>> "\n"s into an [nt]roff document without them being interpreted?
>In <156@vcvax1.UUCP>, paul@vcvax1 response:
>> The way to get a `\' in the output is to use a `\e' in the input.
>> So use `\en' to get `\n'.
>Allow me to play dumb for a moment... (cause on this one, I really
>am.)  All these responses seem to focus on useing "\e" to get a
>literal "\".
>3.  What is the recommended way to include source code into a
>    document?

The problem is that all too often text which you think is just going
to go in and come out actually gets caught in a diversion and re-
processed elsewhere and elsewhen.  This was the problem with the old
solution of multiple escape chars: how many escapes escape an escape?
Similarly, how many levels of .eo<NL>\.eo<NL> should we use?

I believe there's a way to include something at the last minute (after
most all processing's done), but it escapes me at the moment ...
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}