nmh-workers
[Top] [All Lists]

[nmh-workers] Handling empty components

2019-03-20 19:55:26
Is there a concise way to specify "if X is not present or is just
white space?" in one's replcomps?

The "X" in my case is the "Reply-To" component, and I recently
received for the first time ever a message that contained an
_empty_ one (and that I wanted to reply to) -- i.e.

     From:  foo@bar.com
     To:  dnc2dnc@gmail.com
     Reply-To: 
     [...]

Note:  there is a space character after the "Reply-To:" above.
(If I remove the space, then the "Reply-To" component is seen as
empty, as expected.)

My replcomps is (I think) pretty standard, and starts with:

     %(lit)%(formataddr %<{reply-to}%?{from}%?{sender}%?{return-path}%>)\
     %<(nonnull)%(void(width))%(putaddr To: )\n%>\

This results in NMH generating a reply with _no_ "To:" header
because of the "(nonnull)" check.  At least, that is my guess --
the mh-format(5mh) man page says that nonnull checks whether the
str register is "non-empty."

I'm guessing I can add a bunch of "(nonnull)" checks when trying
to find the address for the "To:" header, but I'm wondering if
there is a better, more compact option.  Also, this is the first
time in nearly 30 years of using (N)MH that I've encountered this
situation, and I don't want to complicate my setup for such a
rare problem.

Thanks!

                                Bob

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

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