On Sun, Sep 07, 2025 at 01:54:58AM -0400, Mark Manning wrote:
> infocmp -1 for the 256 color xterm terminfo file shows the following format
> string
> 
> u8=\E[?%[;0123456789]c,
> 
> ...but what is the %[  operator?  Is this a "harmless" mistake or an
> undocumented operator?? :)

It's used by tack, not used by ncurses.  Since it's not used by ncurses,
the ncurses documentation as such is in the terminfo.src file:

        # The terminal answerback description (u8) must consist of an expected
        # answerback string.  The string may contain the following scanf(3)-like
        # escapes:
        #
        #       %c      Accept any character
        #       %[...]  Accept any number of characters in the given set

If it were used by ncurses, there would be additional information in user_caps

That's not new (dates from 1995), but I modified tack this spring to do some
checking of the patterns against actual response.  In a quick check, I don't
see any recent change to the terminfo database in that area, so the existing
comments in terminfo.src are enough.

> The only thing I see in man 5 terminfo is the following entry which does
> not seem to correspond with the above...
> 
>        %[[:]flags][width[.precision]][doxXs]
>             as  in printf(3), flags are [-+#] and space.  Use a “:” to
> allow the next character to be a
>             “-” flag, avoiding interpreting “%-” as an operator.
> 
> 
> 
> 
> 
> -- 
> “When something can be read without effort,
> great effort has gone into its writing.”
> 
> ― Enrique Jardiel Poncela ―

-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to