daw@houxs.UUCP (08/18/87)
I am unable to get the .! request to function successfully under troff, although it works under nroff. My system is a VAX 8600 running UNIX SVR2 (there are no attached text-processing processors). The system administrator of this machine has been unable to track down the problem. The problem is that the .! request appears to be ignored when processed by troff, while nroff correctly implements it. As a test case, the following file: This is a test of the .! troff capability. .! echo "This is only a test." prints under troff: This is a test of the .! troff capability. but prints under nroff: This is a test of the .! troff capability. This is only a test. (the outputs are simulated here, and yes, the original input didn't have tabs at the beginning of the lines). On a related note, my documentation states that the format for this request is .! cmd args The UNIX command cmd is executed and its output is interpolated at this point. The standard input for cmd is closed. which implies to me that I can't (for instance) use this request to set up a pipeline. Am I being mislead by my documentation? (I ordered the newest release of the documentation 2 months ago, but still no sign of it :-( ). All suggestions, hints, etc., gratefully received. David Wolverton ..!ihnp4!houxs!daw
jay@unm-la.UUCP (Jay Plett) (08/19/87)
In article <501@houxs.UUCP>, daw@houxs.UUCP (D.WOLVERTON) writes: > I am unable to get the .! request to function successfully ... > As a test case, the following file: > This is a test of the .! troff capability. > .! echo "This is only a test." > ... my documentation states that the format for this request is > .! cmd args The UNIX command cmd is executed and its output > is interpolated at this point. The standard input --------- wrong? --------->^^^^^^^^^^^^^^^^^^^^^^^^^^ > for cmd is closed. The ".!" request, aka ".sy", was added to [nt]roff with the Device- Independent troff modifications. For all versions of ditroff I have seen, the above documentation is wrong. The output of "cmd" is NOT interpolated, it merely goes to stdout (whatever that might mean for any particular invocation of troff). To get what you expect, modify your input file as follows: This is a test of the .! troff capability. .! echo "This is only a test." > /tmp/tx\n($$ .so /tmp/tx\n($$ .! rm /tmp/tx\n($$ What actually happens is that any blanks after ".!" are skipped, then everything up to the end of the line is passed to the "system" library function which should exec "sh -c [your line]". The line may contain anything that you could type to a shell prompt, including pipes, redirection and shell expansions or substitutions. [nt]roff escapes WILL be interpreted before passing the line to a subshell. -- Jay Plett UUCP: {cmcl2,ihnp4}!lanl!unm-la!jay {ucbvax,gatech}!unmvax!unm-la!jay ARPA: jxyp@lanl.gov
daw@houxs.UUCP (D.WOLVERTON) (08/20/87)
(In best Emily Litella voice) Never miiiind! The nroff/troff update docs which I had ordered 2 months ago just arrived today (one day late for the purposes of this posting) ((actually, they arrived for my officemate; mine haven't arrived yet)). They clearly state (in an Addendum dated November 1986) that the .! request has been "deleted". :-( They go on to suggest the use of the .sy request (which discards its output) to pipe the data into a temp file, then use .so to insert the file into the document. And so it goes. Dave Wolverton ..!ihnp4!houxs!daw