[Top][All Lists]

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

Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana

From: G. Branden Robinson
Subject: Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana
Date: Wed, 19 Apr 2023 16:50:24 -0500

At 2023-04-17T13:15:50+0100, Ralph Corderoy wrote:
> Why the dance with ‘tprint’?  sed -n s/foo/bar/p

I overlooked that 'p' is a standard replacement flag going back (at
least) to SuSv1/POSIX Issue 4.  Thanks, I'll change that.

> The \ in \.nr isn't needed.  It isn't in the other one.

Right; I already got rid of it.

> To match one or more p's in a BRE, the idiom is pp* rather that p*p.
> Though I'm not sure it's necessary here for the spaces.
> The substitution's address is different from its pattern in that
> ‘Pagesize:’ matches the former but not the latter.

I'll fix that/those too.  I'd prefer to be a bit flexible with the
pattern matching; I don't feel the poppler developers carefully designed
their report format.  For example:

CreationDate:   Sat Mar 25 18:43:18 2023 CDT
ModDate:        Sat Mar 25 18:43:18 2023 CDT
UserProperties: no
Page size:      612 x 792 pts (letter)
Page rot:       0
File size:      106745 bytes

Why StudlyCaps for some field names and multi-word phrases for others?
Why abbreviate "rotation" when it will fit, thanks to the lengthy
"UserProperties"?  My money is on people heaping more stuff in without
giving thought to what was already present.

The bottom line is that I don't trust poppler not to change the quantity
of spaces we encounter.  If there were a standard sed 's' command flag
for case-insensitive matching, I'd add that in, too.  But I'll continue
to expect at least one after 'Page' and after 'size'.

> One could
>     sed -ne '/^Page *size: *\([0-9.][0-9.]*\) *x *\([0-9.][0-9.]*\).*$/s//.nr 
> pdfpic*width (p;\1)\
>     .nr pdpic*height (p;\2)/p'

I think the ultra-long line is difficult to read, so I broke it up into
chunks by assembling a roff string.  That in turn resurrected the
necessity for doubling the backslashes.

> Its idiomatic to have the pipe at the end of the line.

I'm not familiar with this idiom, and don't agree with it.  It may be
obviated now, given the roff string construction approach.

> By design, this also avoids the backslash clutter in the shell.

Not relevant to the contents of a roff macro file.

Thanks for the tips.  It turned out sed wasn't really the problem here,
but an anemic means of constructing C/C++ strings for passage to


Attachment: signature.asc
Description: PGP signature

reply via email to

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