procmail
[Top] [All Lists]

canonicalizing header name case

2000-02-16 14:40:14
Era wrote,

| A simple way to accomplish that is to write a small wrapper which does the
| locking, and call the wrapper instead of the real thing. (You can call it
| by the same name as the real script, just put it in a directory which is
| earlier in your -- and Procmail's -- PATH.)

Eek, NO!  That's the same bad idea as using "rm" as the name of your alias
for "rm -i".  Give your wrapped version a different name.

The only time I would ever suggest using the same name earlier in the path is
the case of your having compiled a more recent version for your own use while
the admins are dragging their feet about upgrading.  If yours behaves diffe-
rently in any way that the system binary copy shouldn't catch up with, give
it its own name.

| The Perl lowercase-and-canonicalize thing is pretty neat. If it were
| mine, I might still go out of my way to avoid running Perl for a
| simple job like this, but I can't come up with something equally
| succinct and elegant.

formail does a lovely job of canonicalizing the casing of field names:

  formail -R Subject: Subject: -R Reply-To: Reply-To: -R Cc: Cc: 

for example.  No matter how the name is cased in the input, the output will
take the casing from the second argument to -R.  I find that invaluable when
I'm going feed the head to sed and expect it to recognize /^Subject:/ or when
I'm going to read the message with an MUA that chokes on "Reply-to:" or "CC:"
or such.

| (There's a neat trick for lowercasing matches, by David Tamkin; it
| involves matching against a "canonicalized" version of the strings you
| expect to match, and use the \/ grab operator to grab the matched
| canonicalized string. Don't worry if this description scares you -- I
| guess it ought to. :-)

Thank you, Era.  I've been known to frighten demons into scurrying back into
hell.

DW alias scr='rm -i' T

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