user input using nroff/troff

Larry Wall lwall at jpl-devvax.JPL.NASA.GOV
Thu Jul 26 04:46:59 AEST 1990


In article <494 at travis.csd.harris.com> brad at SSD.CSD.HARRIS.COM (Brad Appleton) writes:
: Ive looked thoroughly in two sets of manuals for this and I still dont 
: know how to do it (or if it can be done) ...
: 
: What I want to do is have (n|t)roff prompt me for input and then assign
: the input to a string, all this without having roff print the input in
: the document after it reads it.
: 
: Ive noticed that I can print a prompt using the .tm request and I can
: read input with .rd request, but .rd immediately inserts the text into
: my document. I want a macro named input so that:
: 
: .input name prompt
: 
: will print prompt to the user, read in input from the user, and assign
: the result to the string "name" (using .ds I assume).
: 
: Any hints/suggestions would be appreciated!

You can try using a diversion.  Like this:

.di xx
.rd prompt
.br
.di
This text will be before the input.
.xx
This text will be after the input.

The .input macro is left as an exercise for the reader.

Larry Wall
lwall at jpl-devvax.jpl.nasa.gov



More information about the Comp.unix.questions mailing list