[Top][All Lists]

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

[Groff] Re: Help with groff

From: Ted Harding
Subject: [Groff] Re: Help with groff
Date: Mon, 25 Jun 2001 21:39:07 +0100 (BST)

TO THE GROFF LIST: Please read through this reply to a private
mail. If any of you can take this story further, it would be
most helpful.

Hi Margo,

On 25-Jun-01 Margo Cherney wrote:
> Dear Mr. Harding,
> I hope you don't mind my asking for help on a operating system you
> know nothing about.

Well, I used to use DOS a lot, and even ran groff on it. So I think
I can help you with the problem you report below. (It's Windows I
don't know much about, and I've never used groff on Windows).

> Thank you for your help. When I wrote the first
> time I put the program in the c:\groff directory. I moved it to
> c:\programfiles\groff. You might know that MS-DOS (not Windows)
> only allows 8 letters for filenames so this would really be
> c:\progra~1\groff.
> I searched for DESC files in the groff directory and found one in
> each of 12 folders located in c:\progra~1\groff\share\groff\1.17\font.

Good, that is as it should be!

> When I use this command:
>    groff -a -man trial > trial.asc
> it works with no error message (although for some reason it's not
> formatted as it should be.)

For why no error message, see below. The mis-formatting may be
another story.

> When I try: 
>   groff trial > (is this correct?)

OK in theory, yes.

>I get this error message:
> grops:<standard input>:4:fatal error: cannot open `/tmp/groffa88425':
> No such fle or directory

OK, this is an old chestnut which I had to work round when I was using
groff on DOS back in 1990 (and it took me a while to suss out what was
happening). Remember that the groff program itself does not do much
work: its primary function is to generate a command which assembles
as a "pipeline" the necessary elements of the groff suite of functions
(preprocessors eqn, pic, tbl ... ; troff, the main formatting program
which really does do most of the work; postprocessors grops [for PS],
grotty [for bald tty output], grolj [for laser-printer codes] ... ),
and then submits that command to the operating system.

Because DOS does not implement pipes UNIX-fashion, the pipe mechanism
is emulated by using temporary files. In UNIX, the command-line generated
by groff for your "groff trial >" would be

  troff -Tps trial | grops >

since the default "device" for troff is PostScript and grops, the
PostScript post-processor, is then run automatically; the output
from troff is "piped" straight into the input of grops. What happens
with groff on DOS is the equivalent of

  troff -Tps trial > a_temp_file
  grops a_temp_file >

and owing to what I have always considered misconceived code in DOS troff,
the temp file name is an impossible one for DOS (namely /tmp/groffa88425),
which has 11 letters (it would be OK with a "point": /tmp/groffa88.425
which I am sure was the intention). So the file does not exist with that
name and cannot be found.

Now, with that explanation, you can work round it: Try, with your same
file "trial", the two commands

  troff trial > trial.tmp
  grops trial.tmp >

and I think you will find that it should work. (Whether it formats it
as you wanted is another story).

Back in 1990, when I was running groff on DOS, I wrote a ".BAT" file
to do this sort of thing for all (or most of) the combinations that
groff covered. I don't think I have it around now, though I could look
(it will be on some disused 100MB hard drive that weighs about 10 kilos).
I also once posted it to the old groff list, years ago. Maybe someone
still has a copy.

If you want to concoct the commands yourself, use the "-V" option for
groff. This makes it simply write out what the command line should be,
and nothing else. For instance, if you want to use the eqn and pic
preprocessors, the ms macros, and an ASCII output file, your normal
groff line would be

   groff -Tascii -ep -ms trial > trial.asc

so do it as

   groff -V -Tascii -ep -ms trial

(leaving off the "> trial.asc") and get the output

  pic trial | eqn -Tascii | troff -ms -Tascii | grotty

which you can now chain together as something like

  pic trial > trial.pic
  eqn -Tascii trial.pic > trial.eqn
  troff -ms -Tascii trial.eqn > trial.trf
  grotty trial.trf > trial.asc

(re-instating your "> trial.asc" at the end).

Now you can also understand why you got no error message with

  groff -a -man trial > trial.asc

since if you run

  groff -aV -man trial

you will get

  troff -a -man -Tps trial

i.e. there are no preprocessors and no postprocessors, i.e. no
pipes, and therefore no need for temp files! (The "-a" option
causes troff itself to generate "an ascii approximation" as its
direct output).

I hope this helps.

I'm also going to copy this reply to the groff list, because I
think you must be suffering with an old DOS groff; I'm sure
someone should have sorted out this bug, but I never found out;
and once I moved to Linux I lost interest in DOS groff! Maybe
some folks there will know more.

All the best,

E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 25-Jun-01                                       Time: 21:39:07
------------------------------ XFMail ------------------------------

reply via email to

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