My experiments indicate that mh-format, at least as applied to scan, does not
distinguish between a header with zero length content and a non-existent
header. Am I correct? I can't find any documentation saying that.
That .... is correct.
Internally, a that has no field text will have an internal text element
of zero length (the pointer will be valid, but the length will be zero).
A header that does not exist will have a text element set to NULL. Mind
you, a header consisting of nothing but white space will be read as "true"
in the sense of mh-format(5) tests. But there's nothing in the format engine
that distinguishes between a NULL string and a zero-length string.
Maybe there is a standard that says that all components must have or should
have a content (what RFC 5322 calls a field body) of positive length.
I do not read the RFC that way; it looks like to me it's perfectly valid
to have a zero-length field body (except for a few headers that are
required to have a certain number of addresses).
In any case, is there a workaround that would let me write a format that would
treat a message with a component like
Foobar:
differently from a message without a "Foobar" component -- maybe some
legerdemain like appending 'X' and asking if the result is equal to 'X'.
You don't really have the ability to manipulate the components in such a way,
unfortunately. It does occur to me that by simply adding an instruction that
checked to see if the "str" register was a NULL pointer or not would suffice
for your needs.
I might note that
pick --Foobar ''
Selects messages having a foobar component, with or without non-empty content.
Right, because that's operating directly on the message; the format engine
is not involved.
--Ken
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers