3 Parses MailScanner configuration files.
5 Author: Andrew Colin Kissa <andrew@topdog.za.net>
6 Baruwa Enterprise Edition http://www.baruwa.com
9 This file is licensed under the LGPL v2+.
11 About: Configuration files
12 This lens applies to /etc/MailScanner/MailScanner.conf and files in
13 /etc/MailScanner/conf.d/. See <filter>.
19 (************************************************************************
20 * Group: USEFUL PRIMITIVES
21 *************************************************************************)
22 let comment = Util.comment
24 let empty = Util.empty
30 let non_eq = /[^ =\t\r\n]+/
32 let non_space = /[^# \t\n]/
36 let word = /[A-Za-z%][ :<>%A-Za-z0-9_.-]+[A-Za-z%2]/
38 let include_kw = /include/
40 let keys = word - include_kw
42 let eq = del /[ \t]*=/ " ="
44 let indent = del /[ \t]*(\n[ \t]+)?/ " "
46 let line_value = store (non_space . any . non_space | non_space)
48 (************************************************************************
50 *************************************************************************)
52 let include_line = Build.key_value_line include_kw space (store non_eq)
54 let normal_line = [ key keys . eq . (indent . line_value)? . eol ]
56 (************************************************************************
57 * Group: Lns and Filter
58 *************************************************************************)
60 let lns = (empty|include_line|normal_line|comment) *
62 let filter = (incl "/etc/MailScanner/MailScanner.conf")
63 . (incl "/etc/MailScanner/conf.d/*.conf")
65 let xfm = transform lns filter