groff
[Top][All Lists]
Advanced

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

Re: [groff] 1.22.4.rc4 - Final RC before official 1.22.4


From: Ralph Corderoy
Subject: Re: [groff] 1.22.4.rc4 - Final RC before official 1.22.4
Date: Sat, 08 Dec 2018 11:28:40 +0000

Hi Ingo,

> > > > The time-honoured way to get modern-day `printf foo' is
> > > > 
> > > >     echo foo | tr -d \\012
>
> Why would you want to return to echo(1)?

Because I was giving the `time-honoured way' and I thought I saw a
recent mention on this that if something still works on older systems
then it's nice not to needlessly break it.

> >       | tr -d \\\\\\\\012 \
...
> Back then, the escaping record in one of the Perl scripts used to
> prepare submissions to TeXing was - eight successive backslashes.

It tends to be a power of two.  I once needed six, which I thought was
nice.  Sometimes, no number of backslashes works.
https://github.com/onetrueawk/awk/blob/master/FIXES#L638

>  .  pso sh -c \
>         "printf '%s' '.ds *f ' ; \
>          ls \\*[fontpath]/dev\*[.T] \
> -        | tr '[:cntrl:]' '[ *32]'"
> +        | tr '\\\\n' ' '"
>  .  \"        This dummy line is necessary; the preceding line eats it.

I've avoided trying to understand the aim until now.  Given zero or more
files in a directory, the string `*f' should be set to their names?
sed makes this easy.

    $ for n in {0..3}; do
    >     (echo '.ds *f'; seq $n) |
    >     sed '$!s/$/ \\/'
    > done
    .ds *f
    .ds *f \
    1
    .ds *f \
    1 \
    2
    .ds *f \
    1 \
    2 \
    3
    $

As a `.pso':

    $ cat ingo.tr
    .pl 1
    .nf
    .ds fontpath /usr/share/groff/1.22.3/font
    .pso (echo '.ds *f'; ls \*[fontpath]/dev\*[.T]) | sed '$!s/$/ \\\\/'
    .tm *f=`\*(*f'
    $
    $ nroff -U ingo.tr
    *f=`B BI DESC I R'

    $

Using `[:cntrl:]' to try and wipe out a `\n' in the name of portability
to systems with unknown behaviour is misleading.  As the reader, I
thought the aim was to wipe out any and all control characters.
Puzzled, that's when I took the time to try and understand the aim.  :-)

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy



reply via email to

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