anomy-list

Re: syntax for using with exit codes

From: mark david mcCreary (02068@xyz.molar.is)
Date: Fös 11 Ágú 2000 - 00:52:44 UTC


>The "e" flag to procmail makes it only execute the formail rule if the
>sanitizer returns a non-zero exit code. Unfortunately, I haven't quite
>figured out how to access the code itself from within procmail. Any tips
>would be very welcome.
>

Bjarni

Thanks for the answers to my questions.

Perhaps the part below is helpful to you.

Quoting from Jari Aalto's Procmail tips page at
http://www.procmail.org/jari/pm-tips.txt

    9.8 Passing values from an external program

        External programs cannot set procmail variables directly. Programs
        must write the values to external files and then read the values
        from these files. Capturing only one value is easy:

            var = `command` # capture STDOUT

        But if a program modifies the body and exports some status
        information it is trickier. We assume here that the script is
        controlled by you and that you have added the switch
        --export-status option which causes the program to print
        information to a separate file.

            LOCKFILE = $HOME/.run$LOCKEXT # protect external file writing
            valueFile = $HOME/tmp/values

            # modify body, and export status values to external file: one
            # value in every line
            #
            # VALUE1
            # VALUE2
            # VALUE3

            :0 fb
            | $NICE script.pl --export-status $valueFile

            values = `cat $valueFile`

            # Derive values from each line

            :0 # line 1
            *$ values ?? ^^\/[^$NL]+
            {
                var1 = $MATCH
            }

            :0 # line 2
            *$ values ?? ^^.*$\/[^$NL]+
            {
                var2 = $MATCH
            }

            :0 # line 3
            *$ values ?? ^^.*$.*$\/[^$NL]+
            {
                var3 = $MATCH
            }

            LOCKFILE # Release lock

        [richard] Alternatively write valueFile from your rc or external
        program with lines like

            PARAM1="value for param 1"
            PARAM2="value for param 2"
            PARAM3="value for param 3"

        and read it with

            INCLUDERC $valueFile

        Now there is no need to worry about synchronizing the read with the
        lines, or about adding new parameters, since each is labeled in
        valueFile.

-- 
This mailing list's home page is: http://mailtools.anomy.net/archives/anomy-list/
There you can find subscription instructions and possibly an archive.
Molar.is is a free Icelandic mailing list service.



hosted by molar.is