groff
[Top][All Lists]
Advanced

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

Re: [PATCH] lint-man.mk: Use a pipeline instead of the groff(1) wrapper


From: Alejandro Colomar
Subject: Re: [PATCH] lint-man.mk: Use a pipeline instead of the groff(1) wrapper
Date: Sun, 28 Aug 2022 13:53:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2

Hi Ralph, Branden,

On 8/28/22 13:20, Alejandro Colomar wrote:
Hi Ralph,

On 8/28/22 10:36, Ralph Corderoy wrote:
Hi Alejandro,

+DEFAULT_EQNFLAGS := -Tutf8
...
+DEFAULT_TROFFFLAGS   += -Tutf8

I'd have a variable set to ‘utf8’ to ease changing to another output
device.

Done; thanks!  And as I said in another thread, I changed it back to ascii, since I noticed a problem with boxed tables (actually several).

I noticed another issue: for some reason, the boxed tables are being generated wider than the terminal, exactly by one char.  If I specify -rLL=80, the right edge of the box is placed at column 81; if I specify LL to be 72, the right edge of the box is at col 73.

See the example below (I tweaked it to use 64 chars to overcome Thunderbird issues):


$ tbl man3/err.3 \
   | eqn -Tascii \
   | troff -man -t -M ./etc/groff/tmac -m checkstyle -rCHECKSTYLE=3 \
           -ww -Tascii -rLL=64n \
   | grotty -c \
   | col -b -x \
   | (! grep -n '.\{64\}.')
21:       noreturn void verr(int eval, const char *fmt, va_list args);
22:       noreturn void verrx(int eval, const char *fmt, va_list args);
51:       +-----------------------+---------------+----------------+
52:       |Interface              | Attribute     | Value          |
53:       +-----------------------+---------------+----------------+
54:       |err(), errx(), warn(), | Thread safety | MT-Safe locale |
55:       |warnx(), verr(),       |               |                |
56:       |verrx(), vwarn(),      |               |                |
57:       |vwarnx()               |               |                |
58:       +-----------------------+---------------+----------------+


Do you know how I can fix that?

Hmmm, I've been testing things, and groff -rLL=78 behaves as MANWIDTH=80 man. That's weird. We come back to this 78 issue we didn't know exactly why it was there.

Searching through man-db's source code, it seems to confirm that subtraction:

alx@asus5775:~/src/cjwatson/man-db$ grepc get_line_length
./lib/linelength.h:23:
int get_line_length (void);


./lib/linelength.c:49:
int get_line_length (void)
{
        const char *columns;
        int width;
#ifdef TIOCGWINSZ
        int dev_tty, tty_fd = -1;
#endif

        if (line_length != -1)
                return line_length;

        line_length = 80;

        columns = getenv ("MANWIDTH");
        if (columns != NULL) {
                width = atoi (columns);
                if (width > 0)
                        return line_length = width;
        }

        [...]
}

alx@asus5775:~/src/cjwatson/man-db$ grepc get_roff_line_length
./src/man.c:651:
static int get_roff_line_length (void)
{
        int line_length = cat_width ? cat_width : get_line_length ();

        /* groff >= 1.18 defaults to 78. */
        if ((!troff || ditroff) && line_length != 80) {
                int length = line_length * 39 / 40;
                if (length > line_length - 2)
                        return line_length - 2;
                else
                        return length;
        } else
                return 0;
}


Cheers,

Alex

--
Alejandro Colomar
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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