bug-groff
[Top][All Lists]
Advanced

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

[bug #64061] pdfpic.tmac resorts to undocumented magic


From: G. Branden Robinson
Subject: [bug #64061] pdfpic.tmac resorts to undocumented magic
Date: Fri, 21 Apr 2023 22:39:16 -0400 (EDT)

Follow-up Comment #6, bug #64061 (project groff):

And because I couldn't resist testing my mad sed stunta skillz, here's a proof
of concept.


$ cat ATTIC/fake-pdfinfo 
#!/bin/sh

cat <<EOF
Creator:        groff version 1.23.0.rc3.81-9e3e4
Producer:       gropdf version 1.23.0.rc3.81-9e3e4
CreationDate:   Sat Mar 25 18:43:18 2023 CDT
ModDate:        Sat Mar 25 18:43:18 2023 CDT
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          1
Encrypted:      no
Page size:      612 x 792 pts (letter)
Page rot:       0
File size:      106745 bytes
Optimized:      no
PDF version:    1.4
EOF
$ cat ATTIC/stunt.sed
/Page  *size:/s/Page  *size:  *//;h;s/\([0-9.]*\)  *x  *\([0-9.]*\).*$/.nr
pdfpic*width  (p;\1)/p;x;s/\([0-9.]*\)  *x  *\([0-9.]*\).*$/.nr pdfpic*height
(p;\2)/p
$ ./ATTIC/fake-pdfinfo | sed -n -f ATTIC/stunt.sed
.nr pdfpic*width  (p;612)
.nr pdfpic*height (p;792)


It worked on the first try.  Maybe I'm a less crap sed programmer than I
thought.

But at any rate I feel this is a bit lengthy, so I think I prefer solution 3,
`\R`.

I'm sure the FSF wouldn't appreciate me putting a "licensable" photograph of a
skateboarder's skull about to meet high-speed concrete, so the reader will
just have to imagine one.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64061>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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