On Tue, Aug 04, 2026 at 01:50:16PM +0200, Alejandro Colomar via Mutt-dev wrote:
From: "Kevin J. McCarthy" <[email protected]>

Thanks to Alejandro Colomar for this suggestion, and I used his
examples directly for LOWER_C to PFCHAR_C.  The HEX additions are
mine, so you can blame those on me. ;-)

:-)

Actually, since there's the standard [:xdigit:] and isxdigit(3), I'd
call it (and actually called it in shadow-utils) CTYPE_XDIGIT_C:

        #define CTYPE_XDIGIT_C         CTYPE_DIGIT_C "abcdefABCDEF"

Thanks, I've renamed them to CTYPE_XDIGIT_C and CTYPE_UXDIGIT_C.

Please let me know what you think.  Does it help readability for the
cases where we use the CTYPE along with extra characters?
e.g. imap/command.c, lib.c, muttlib.c  below.

Yup, IMO.  Where thr RFCs use a name for that, I'd give them a new name
(see for example, CTYPE_LDH_RFC1035_C above, which corresponds to
RFC1035's <ldh-str>), but where there's not a standard-ish name, I guess
direct use like this is fine.
<https://www.rfc-editor.org/info/rfc1035/#section-2.3.1>

Okay.

diff --git a/imap/command.c b/imap/command.c
index 63dedf6c..94c98883 100644
--- a/imap/command.c
+++ b/imap/command.c
@@ -701,7 +701,7 @@ static void cmd_parse_vanished(IMAP_DATA *idata, char *s)
   end_of_seqset = s;
   while (*end_of_seqset)
   {
-    if (!strchr("0123456789:,", *end_of_seqset))
+    if (!strchr(CTYPE_DIGIT_C ":,", *end_of_seqset))

I wonder if this character set has any name in RFC 7162.  I can't find
it, though.  The only reference to DIGIT seems to be in
mod-sequence-value.

In RFC 7162 there is:
   expunged-resp       =  "VANISHED" [SP "(EARLIER)"] SP known-uids
   known-uids          =  sequence-set
                          ;; Sequence of UIDs; "*" is not allowed.

sequence-set is in RFC 3501:
   sequence-set    = (seq-number / seq-range) *("," sequence-set)
   seq-range       = seq-number ":" seq-number
   seq-number      = nz-number / "*"
               -> except note the '*' is not allowed in known-uids
   nz-number       = digit-nz *DIGIT

So it's just a sequence of UIDs or UID ranges, each command separated,
with '*' disallowed.  Thus this addition of "," and ":".  Is this worth
making a special name for?

-static const char safe_chars[] = 
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+@{}._-:%";
+static const char safe_chars[] = CTYPE_PFCHAR_C "+@{}:%";

LGTM.  Are those extra safe chars specified by any standard, or is it
just of this project?

Not that I can tell.  It goes way back in the commit log to 986ab5e9.

+#define CTYPE_PFCHAR_C       CTYPE_ALNUM_C "._-"    // POSIX.1-2008 portable
+                                                    // filename character set

Actually, that was already true as of POSIX.1-2001 (Issue 6); the first
modern-day POSIX, where POSIX and SUS (the Single UNIX Specification)
were unified

I suspect this was already true way earlier, since I see a reference to
the 'portable filename character set' in XPG Issue 4 (v2) (from which
modern-day POSIX derives).
<https://pubs.opengroup.org/onlinepubs/009656499/toc.pdf#page=423>
I don't see the the definition of the p.f.c.s. in that document, because
it was in a separate volume, and I can't find it.  It's also difficult
to find older standards, unless you know where they are.  :)

Okay, I'll just leave it as "portable filename character set" in the
comment then.

LGTM.

Great.  Thanks Alex!

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to