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 <anMvsJkRu1F3F0-0@devuan>
> Date: 2026-08-05 14:17:48+0200
> From: Alejandro Colomar <[email protected]>
>
> 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.

Self-correction; since '*' is not allowed, it's not really sequence-set.
Let's call it maybe this?:

	#define CTYPE_UIDS_RFC7162_C  CTYPE_DIGIT_C ":,"  // known-uids


Cheers,
Alex

> 
> 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>



-- 
<https://www.alejandro-colomar.es>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmpzL/AACgkQ64mZXMKQ
wqlhTg//bIRPKGCmPiRjkh/UM+ane5OsG8gdAGCihQo0qomNvsyupm6xTWsl03Vn
Oo9RSs3bnIPLGXaNAT1ZCxP2RnvVsO0xjF5rPZ82tPmT5Av9Dh11m+Fp1Z7Fy/lo
Hkhbondo+YiE5m7hZ14ut22row8aGUmeHJKqSeFmdlj9CIT2VeEnMtR6BXSTyMxf
IxLa6ePH6yZDNJhj/XtBiH77HHJnIFQzl4XKWA5kg/A9o6RNixAdAjElk5NGdIdg
ZUYiURLd4yO6X/dG/nOOAN5uQC6nFZJ9xbW3A9VG6SBRPpETBJK53dlHZeRQr+/j
mdhZCHdf3J3YVuNZaVDJJd18xDcUvpbRzGluAxc/ntf6UJzTvYY9Bw1pZMCOzyzU
EcExinQGAOE0Meh9UoLguhGg/z9PQht4TxqinVyWOLDYj7dLkwQufagdoU5O6+2z
LbKUJAwiE4OSoMvfq32IpRrcgPYkIL2nGfuWfZ500eHkR/jBV093FUFUGviiFOSg
JqdZhWqzeIneqEedkhu2OcByHIizReiCYUkmXZMzFTBXH0JDo6O3bogY9OzXDgJa
3d7kfpZnBHehB+3O4BzrEYn5iIFAmwrTLH8I3HTsV8iD+O5MbJma3zFcNGBJsyw5
x+5+jJkFIcx2HYE6SqbpNex0e1GzQ17m14BxX5g4jU5ROUsMT5I=
=suXO
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.