procmail
[Top] [All Lists]

Re: Trouble with "??"

1996-10-29 11:50:45
Why are you using "gawk" here? The procmail way to do this is:

              :0 B
              * ^[      ]*begin *\/[^ ]+
              { PW=$MATCH }

    >         :0 BiW: nscrab.lock
    >         * PW ?? ^[0-9]
    >         ntest_found

Since you are not running a regexp on the body, don't use "B" in the
flags.   If you are running a program called "ntest_found", and
if it doesn't read all of STDIN, then you do need "i", otherwise it
is not used.  If you are running a program for its return status,
then use "W".  

From your use of the "i" and "W" flags, I'm assuming that "ntest_found"
is a program, and not a file to be filed.  If so, then you need to
prefix the program with "|" to show that it is a program invocation:

As for the failing match, it may be because '^' or '??' didn't work well
together, if at all.  There are still problems with some regexp 
expressions after a '??'.  A common work-around is to parenthesize
the regexp.

Here's how the recipe should look (if my assumptions are correct):

        :0iW:nscrab.lock
        * PW ?? (^[0-9])
        | ntest_found

You can upgrade to the latest version of procmail yourself, for testing
purposes, but it would also be appropriate for your ISP to upgrade
also.

The "else" clause should then be explicitly so:

    :0 ei:nscrab.lock
    | ntest_not_found

Hope this helps.

___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

    >         :0 iW: nscrab.lock
    >         ntest_not_found
    >     }
    > 
    > SUBJ is only set for later use after I pass this hurdle.  I am using
    > named lockfiles for similar reasons.)
    > 
    > My test message contains the line "begin 123456" and PW is
    > set to "123456" as expected, but the test for "PW starts with a digit"
    > fails, as shown in the log file:
    >     procmail: [11498] Tue Oct 29 12:13:27 1996
    >     procmail: Executing "formail,-rtzxSubject:"
    >     procmail: [11498] Tue Oct 29 12:13:27 1996
    >     procmail: Assigning "SUBJ=Re: test-this-thing"
    >     procmail: Executing "gawk '/^[        ]*[Bb][Ee][Gg][Ii][Nn]/{print 
$2;exit}' -"
    >     procmail: [11498] Tue Oct 29 12:13:28 1996
    > ->  procmail: Assigning "PW=123456"
    > ->  procmail: No match on "PW ?? ^[0-9]"
    >     procmail: Locking "nscrab.lock"
    >     procmail: Assigning "LASTFOLDER=ntest_not_found"
    >     procmail: Opening "ntest_not_found"
    >     procmail: Acquiring kernel-lock
    >     procmail: [11498] Tue Oct 29 12:13:29 1996
    >     ...
    > 
    > So, what am I doing wrong?
    > 
    > "procmail -v" says it's 3.06pre3, whereas the man pages are for 3.10,
    > so is it possible "??" didn't work back then?  (I can probably get my
    > ISP to upgrade if necessary.)
    > 
    > Thanks in advance,
    > Stan Ryckman (stanr(_at_)tiac(_dot_)net)

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