groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Trying to escape user input.


From: Clarke Echols
Subject: Re: [Groff] Trying to escape user input.
Date: Mon, 21 Apr 2008 18:16:09 -0500
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)

If what you are picking up as user input contains text with a line
starting with ".", insert "\&" in front of it.  That places a
zero-width space at the start of the line and puts the dot in
third place on the line so it gets ignored as a command.  Thus
a line starting with ".rt" becomes "\&.rt".

Clarke

Mike Burns wrote:
I'm working on a document that will have certain sections replaced with user
input, and I'd like to make sure that the user input doesn't execute any
roff code.

I'm having trouble figuring out how to escape a "." after a newline.


Looking at the man pages I thought I could just change all "." after a
newline to "\.", and that would escape it, but this doesn't seem to work.  I
created a tiny 2-line roff input program to show my problem.

----------------foo.t--------------
There are many things I'd like to know about the way that roff works.
\.this is a line that starts with a <.>
-------------------------------------


I execute groff with

groff -ms -Tascii foo.t

and this gets written to stderr

foo.t:2: warning: macro `this' not defined

without the -ms package, the warning is not written to stderr, but the 2nd
line still doesn't show up in the output stream.

I'm running groff version 1.19.2

Thanks for any advice you can give.

  mike





reply via email to

[Prev in Thread] Current Thread [Next in Thread]