Prev | Current Page 1573 | Next

Bryan Costales, Claus Assmann, George Jansen, Gregory Shapiro

"sendmail, 4th Edition"

10 and later
Beginning withV8.10, sendmail supports arithmetic computations in rule sets via a database-
map type called arith. This form of database map is always present for your use,
without the need for special compile-time macros. To illustrate one use for arith, consider
this mini configuration file:
V10
Kmath arith
SCalculate
R $+ $+ $+ $@ $(math $2 $@ $1 $@ $3 $: EXCEPTION $)
The K configuration command declares that a database map named math will be of the database-
map type arith. To use this database map we declare a rule set. We call that rule set
Calculate so that rule-set testing will be mnemonically clear.
The rule is the crux of how this math database map is used:
R $+ $+ $+ $@ $(math $2 $@ $1 $@ $3 $: EXCEPTION $)
?†‘ ?†‘ ?†‘
operator lvalue rvalue
The arith database-type database maps (suchas math here) take three arguments. The first,
in the position of the key that would otherwise be used for lookups, is the arithmetic operator.
The legal operators, as of V8.12, are shown in Table 23-5.
Table 23-5. Operators for the arith database-map type
Operator Description
+ Addition: add lvalue to rvalue
- Subtraction: subtract rvalue from lvalue
This is the Title of the Book, eMatter Edition
Copyright ?© 2007 O??™Reilly & Associates, Inc. All rights reserved.
23.7 Alphabetized Database-Map Types | 899
If the arithmetic operator used is not one of those shown in the table (such as an illegal !
operator), the lookup (calculation) fails and the value following the $: operator is returned
(the EXCEPTION).


Pages:
1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585
dieta light życzenia z okazji urodzin dakolen katalog firm Jaki wybrać olej