nmh-workers
[Top] [All Lists]

Re: [nmh-workers] Handling empty components

2019-03-21 23:03:16
Is there a concise way to specify "if X is not present or is just
white space?" in one's replcomps?

We covered this ground a few years ago, here:

  http://lists.nongnu.org/archive/html/nmh-workers/2015-02/msg00139.html

Priescently, I said back then:

Mind you, a header consisting of nothing but white space will be read
as "true" in the sense of mh-format(5) tests

And just to be sure:

% fmttest -raw -format '%<(nonnull{text})Non-null%|Null%>' ''
Null
% fmttest -raw -format '%<(nonnull{text})Non-null%|Null%>' ' '
Non-null

But I see:

% fmttest -raw -format '%(trim{text})%<(nonnull)Non-null%|Null%>' ' '
Null

So Ralph was right, %(trim) does what you want.  But ... %(trim) does
not have a return value (that was probably a mistake), so you cannot use
it directly as a condition for %<. You'll have to make sure your first
test is against the str register rather than Reply-To, and making it work
for all components is actually going to be a bit messy.

You know, since this the first one you've encountered in 30 years, maybe
it is better just to let it go?

--Ken

-- 
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>