procmail
[Top] [All Lists]

pseudo-variables

1997-02-19 00:12:06
David Hunt asked,

| Is 2048 the maximum size for LINEBUF, or can it be set to a larger value?

It can be set to a different value, perhaps a larger one, in the configura-
tions at compilation time or in your rcfile.

| If so, what would the upper limit be, if any? 

That I don't know; it probably depends on the limitations of the hardware and
of the kernel.

| And while I have your attention, what is a 'pseudo variable',
| mentioned in procmailrc manpage regarding special conditions.

A pseudo-variable is one with a non-standard name, such as these:

$1 for the argument of the -a option
$1, $2, $3, etc. or "$@" for the arguments after the rcfile name in
  the -m option
$$ for the process ID
$_ for the current rcfile
$- for the value of $LASTFOLDER
$= for the score of the most recent recipe with any weighted conditions

There are three major differences between pseudo-variables and regular
variables (with normal names that you can assign):

1. You can't change the value of a pseudo-variable with a simple
   assignment (of the variable=value kind).

2. If you want to use the variable ?? regexp syntax in a condition, you can't
   do that with a pseudo-variable.  You have to copy its value into a regular
   variable first and then use the regular variable.

  (BH, HB, B, and H work the opposite way: you can use them in ?? conditions,
   but you can't refer to them as $BH, $HB, $B, or $H.)

3. If an action line (or an exit code condition) invokes a shell, pseudo-
   variables cannot be exported to the shell (all regular variables known to
   procmail are exported and will be in the shell's environment), and the
   shell will use its own idea of what they mean.  For example, if you want
   to pass procmail's process ID and a regular variable to a command that
   procmail will run without invoking a shell, then

   :0 flags
   * conditions
   | command $$ $regvar

   will work.  But if procmail calls a shell to run the command:

   :0 flags
   * conditions
   | command $$ $regvar ;

   the shell will use its own values for $$ and for $regvar.  Now, it will
   have inherited $regvar from procmail, so $regvar doesn't present a prob-
   lem, but it will use its own value for $$, which will be the shell's own
   process ID, not procmail's.  To make it use procmail's process ID, do
   something like this:

   PID=$$ # copy current $$ into a regular variable
   :0 flags
   * conditions
   | command $PID $regvar ;

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