Re: [PATCH] man2/add_key.2: srcfix: Use the correct macro (.I) and escape (\e)

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

 



Hello Branden,
On Wed, 27 Feb 2019 at 11:42, G. Branden Robinson
<g.branden.robinson@xxxxxxxxx> wrote:
>
> At 2019-02-27T11:21:14+0100, Michael Kerrisk (man-pages) wrote:
> > Bjarni,
> >
> > On 1/1/19 10:51 PM, Bjarni Ingi Gislason wrote:
> > >   Use '\e' for printing the escape character, not '\\'.
> >
> > You do not say why such a change is desirable.
>
> *roff escape sequences may sometimes look like C escapes, but that is
> misleading.  *roff is in part a macro language and that means recursive
> expansion to arbitrary depths.
>
> You can get away with "\\" in a context where no macro expansion is
> taking place, but try to spell a literal backslash this way in the
> argument to a macro and you will likely be unhappy with results.
>
> Try viewing the attached file with "man -l".
>
> "\e" is the preferred and portable way to get a portable "escape
> literal" going back to CSTR #54, the original Bell Labs troff paper.
>
> groff(7) discusses the issue:
>
>        \\     reduces to a single backslash; useful to delay its
>               interpretation as escape character in copy mode.  For a
>               printable backslash, use \e, or even better \[rs], to be
>               independent from the current escape character.
>
> As of groff 1.22.4, groff_man(7) does as well:
>
>   \e     Widely used in man pages to represent a backslash output glyph.
>          It works reliably as long as the .ec request is not used, which
>          should never happen in man pages, and it is slightly more
>          portable than the more exact ‘\(rs’ (“reverse solidus”) escape
>          sequence.
>
> People not concerned with portability to extremely old troffs should
> probably just use \(rs (or \[rs]), as it means "the backslash
> glyph", not "the glyph corresponding to whatever the current escape
> character is".

Thanks for the great explanation! Since some existing pages already
use '\e', I've made the switch to '\e' everywhere.

Thanks,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux