Re: [PATCH v2 1/2] Add CTYPE defines for various sets of characters.
Alejandro Colomar via Mutt-dev <[email protected]>
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <anMoJ15bY0AGDFyK@devuan> |
Hi Kevin, > Date: 2026-08-05 11:37:46+0800 > From: "Kevin J. McCarthy" <[email protected]> > [...] > > > 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? Thanks! I'd make a name for it. It'd allow us documenting what you clarified above, so that it's easier to look up when needed. How about this? #define CTYPE_SEQSET_RFC3501_C CTYPE_DIGIT_C ":," // sequence-set I'd document in the commit message that we use it because of RFC7162's known-uids. This name also adds consistency with the surrounding code, which uses' 'end_of_seqset'. I believe that would improve self-explicability of this code. > > > -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. Ok. > > > +#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! Thank you! :-) Have a lovely day! Alex -- <https://www.alejandro-colomar.es>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmpzKeIACgkQ64mZXMKQ wqm00hAAiWPpRnDnXWjSw9zoEIuHUOQopJF00MRTKhaartJ5VfpMNZaIiC3SyjZU i2qvSMjSvXtfpsLXX0WEh2TNs6TmCEBkhThnocBuZuQPPYM4gvJw2EeeRpaVlQaS X8J8N+DCPiIJWdeqHDf1QjHgtygJarlpRN4t2xHycQkLSew65SJiSEOQquQtsdWK XydQJMxvvIksG9QclA1BVBXr2VQjbyXQcOjpCSmIr6BcFl8JKgNORhtTEG5XcIPi PjzVqpV0Y+keFe2d1mczMaLNUmR6l02b53LShQOfIfb5QTdAyjBYAGSHyyjQv8mG iYIoXqbMtYbdsAuvqwG9Z+iJR6R+2Tsg/T1+LP24I6bUuH5XuUUIFFfCkTznJxir G2MmDbAdczqV5Wc7SMZajaCW7F4bPMX3A9xAtRgDwOLUCRm0isTPuPiNDvSPjLr2 9cyx/fL/s/6EXV8VUOeJBQSAaF8R/yzs+wmgiyqpowVtsUqPnrtm4zZ3SjMtC2g/ xW7lXLfy6b+yIVBEQ6dbFzUfIa6ghBfHtaTzwd7VQLxCKWPqePK3lv2kGUWUbhKp gqqt3mriZTo0FY3dx4GDlSQ8sMhfMLZ86Tkwu7ip+RHDLqCnGaqmITM2Vj6PVW/v 2/PV6XiYy7macaiL8nHK5h8uL6gHDLk3Vgns98xJyfyL29N1d3c= =VWSF -----END PGP SIGNATURE-----