brad@SSD.CSD.HARRIS.COM (Brad Appleton) (07/25/90)
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! advTHANXance ______________________ "And miles to go before I sleep." ______________________ Brad Appleton brad@hcx1.ssd.csd.harris.com Harris Computer Systems ...!uunet!hcx1!brad Fort Lauderdale, FL USA ~~~~~~~~~~~~~~~~~~~~ Disclaimer: I said it, not my company! ~~~~~~~~~~~~~~~~~~~
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (07/26/90)
In article <494@travis.csd.harris.com> brad@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@jpl-devvax.jpl.nasa.gov
guy@auspex.auspex.com (Guy Harris) (07/27/90)
>The .input macro is left as an exercise for the reader.
Step 1: get something like SoftQuad's version of "troff", so you aren't
stuck with standard "troff"s crufty 2-character limitations on the names
of macros/strings and number registers.
If you don't have that, you'll have to pick some two-letter name for the
macro....
bryan@iconsys (Bryan Cardoza) (07/31/90)
In article <8869@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: >.di xx >.rd prompt >.br >.di You may also note than in many implementations of [nt]roff, xx can also be refered to as a string variable (which is what you asked about in the first place). In the segment shown above, the .br would still be preserved even when using \*(xx. -- Bryan Cardoza UUCP: uunet!iconsys!bryan Software Engineer Internet: bryan@iconsys.icon.com Icon International, Inc. (801) 225-6888 Orem, Utah FAX: (801) 226-0651