procmail
[Top] [All Lists]

Re: nul detection

1997-12-05 00:10:48
Rik Kabel <rik(_at_)netcom(_dot_)com> writes:
I have been trying to formulate a recipe which catches a nul, and have
not been successful. I can catch bel, but similar tests fail for nul.

In particular, if xx is a procmail rc file with the following:

SHELL=/bin/sh
NUL=`/usr/5bin/echo "\000"`

The problem is that environment variables (and therefore procmail variables)
are null-terminated, and therefore cannot contain a null.  The above line
creates an empty variable.

The solution is to use an inverted character class:

        NUL = `/usr/5bin/echo '[^\001-\377]'`

Note that procmail handles 8-bit characters except for null in procmailrcs,
so you can use a literal control-A and octal-377 in your .procmailrc and
save an echo and shell invocation right there.


Philip Guenther

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