[Top][All Lists]

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

Embedding Filename. (Was Question)

From: Ralph Corderoy
Subject: Embedding Filename. (Was Question)
Date: 10 Jul 2001 22:42:50 +0100

Hi Charlie,

> Please forgive this slightly off-topic post; I haven't been able to
> find *any* other [gnt]roff news group with the slightest activity.
> This one is slow, here, but at least there have been a few posts.

There's also a groff mailing list that gets a little more traffic.  The
groff maintainers, Werner and Ted, read both AFAIK.


> Here's my question:  Is it possible for a [gnt]roof source file to
> access it's own file name?

I've not used it before, but Kernighan's cstr54.ps,
http://cm.bell-labs.com/cm/cs/cstr/54.ps.gz, says for `.lf'

    .lf N filename

        Set line number to N and filename to filename for purposes of
        subsequent error messages, etc.  The number register [sic] .F
        contains the name of the current input file, as set by command
        line argument, so, nx, or lf.  The number register .c contains
        the number of input lines read from the current file, again
        perhaps as modified by lf.

It seems to work just fine.

    % cat t
    file is \n(.F.  line is \n(.c.
    .lf 42 forcharlie
    file is \n(.F.  line is \n(.c.

    % groff -Tascii t | cat -s
    file is t.  line is 1.  file is forcharlie.  line is 42.



reply via email to

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