Imported Upstream version 1.7.0
[platform/upstream/augeas.git] / lenses / thttpd.aug
1 (*
2 Module: Thttpd
3   Parses Thttpd's configuration files
4
5 Author: Marc Fournier <marc.fournier@camptocamp.com>
6
7 About: Reference
8     This lens is based on Thttpd's default thttpd.conf file.
9
10 About: Usage Example
11 (start code)
12     augtool> get /files/etc/thttpd/thttpd.conf/port
13     /files/etc/thttpd/thttpd.conf/port = 80
14
15     augtool> set /files/etc/thttpd/thttpd.conf/port 8080
16     augtool> save
17     Saved 1 file(s)
18 (end code)
19    The <Test_Thttpd> file also contains various examples.
20
21 About: License
22   This file is licensed under the LGPL v2+, like the rest of Augeas.
23 *)
24
25 module Thttpd =
26 autoload xfm
27
28 let comment     = Util.comment
29 let comment_eol = Util.comment_generic /[ \t]*[#][ \t]*/ " # "
30 let empty       = Util.empty
31 let eol         = Util.del_str "\n"
32 let bol         = Util.del_opt_ws ""
33
34 let kvkey       = /(port|dir|data_dir|user|cgipat|throttles|host|logfile|pidfile|charset|p3p|max_age)/
35 let flag        = /(no){0,1}(chroot|symlinks|vhost|globalpasswd)/
36 let val         = /[^\n# \t]*/
37
38 let kventry     = key kvkey . Util.del_str "=" . store val
39 let flagentry   = key flag
40
41 let kvline      = [ bol . kventry . (eol|comment_eol) ]
42 let flagline    = [ bol . flagentry . (eol|comment_eol) ]
43
44 let lns         = (kvline|flagline|comment|empty)*
45
46 let filter      = incl "/etc/thttpd/thttpd.conf"
47
48 let xfm         = transform lns filter