2.9 guimb — A Mailbox Scanning and Processing Language

Guimb is for mailboxes what awk is for text files. It processes mailboxes, applying the user-supplied scheme procedures to each of them in turn and saves the resulting output in mailbox format.

The following configuration statements affect the behavior of guimb:

Statement Reference
debug See section Debug Statement.
mailbox See section Mailbox Statement.
locking See section Locking Statement.

Specifying Scheme Program to Execute

The Scheme program or expression to be executed is passed to guimb via the following options:

-s file
--source file

Load Scheme source code from file.

-c expr
--code expr

Execute given scheme expression.

The above switches stop further argument processing, and pass all remaining arguments as the value of (command-line).

If the remaining arguments must be processed by guimb itself, use following options:

-e expr
--expression expr

Execute scheme expression.

-f file
--file file

Load Scheme source code from file.

You can specify both of them. In this case, the file is read first, then expr is executed. You may still pass any additional arguments to the script using ‘--guile-arg’ option.

Specifying Mailboxes to Operate Upon

There are four basic ways of passing mailboxes to guimb.

guimb [options] [mailbox...]

The resulting mailbox is not saved, unless the user-supplied scheme program saves it.

guimb [options] --mailbox defmbox

The contents of defmbox is processed and is replaced with the resulting mailbox contents. Useful for applying filters to user's mailbox.

guimb [options] --mailbox defmbox mailbox [mailbox...]

The contents of specified mailboxes is processed, and the resulting mailbox contents is appended to defmbox.

guimb [options] --user username [mailbox...]

The contents of specified mailboxes is processed, and the resulting mailbox contents is appended to the user's system mailbox. This allows to use guimb as a mail delivery agent.

If no mailboxes are specified in the command line, guimb reads and processes the system mailbox of the current user.

Passing Options to Scheme

Sometimes it is necessary to pass some command line options to the scheme procedure. There are three ways of doing so.

When using ‘--source’ (‘-s’) or ‘--code’ (‘-c’) options, all the rest of the command line following the option's argument is passed to Scheme program verbatim. This allows for making guimb scripts executable by the shell. If your system supports ‘#!’ magic at the start of scripts, add the following two lines to the beginning of your script to allow for its immediate execution:

 
#! /usr/local/bin/guimb -s
!#

(replace ‘/usr/local/bin/’ with the actual path to the guimb).

Otherwise, if you use ‘--file’ or ‘--expression’ options, the additional arguments may be passed to the Scheme program ‘-g’ (‘--guile-arg’) command line option. For example:

 
guimb --guile-arg -opt --guile-arg 24 --file progfile

In this example, the scheme procedure will see the following command line:

 
progfile -opt 24

Finally, if there are many arguments to be passed to Scheme, it is more convenient to enclose them in ‘-{’ and ‘-}’ escapes:

 
guimb -{ -opt 24 -} --file progfile

Command Line Option Summary

This is a short summary of the command line options available to guimb.

-d
--debug

Start with debugging evaluator and backtraces.

-e expr
--expression expr

Execute given Scheme expression.

-m path
--mail-spool=path

Set path to the mailspool directory

-f progfile
--file progfile

Read Scheme program from progfile.

-g arg
--guile-command arg

Append arg to the command line passed to Scheme program.

-{ ... -}

Pass all command line options enclosed between ‘-{’ and ‘-}’ to Scheme program.

-m
--mailbox mbox

Set default mailbox name.

-u
--user name

Act as local MDA for user name.

-h
--help

Display help message.

-v
--version

Display program version.