Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / host_conf.aug
1 (*
2 Module: Host_Conf
3   Parses /etc/host.conf
4
5 Author: Raphael Pinson <raphink@gmail.com>
6
7 About: Reference
8   This lens tries to keep as close as possible to `man 5 host.conf` where possible.
9
10 About: License
11    This file is licenced under the LGPL v2+, like the rest of Augeas.
12
13 About: Lens Usage
14    To be documented
15
16 About: Configuration files
17    This lens applies to /etc/host.conf. See <filter>.
18 *)
19
20 module Host_Conf =
21
22 autoload xfm
23
24 (************************************************************************
25  * Group:                 ENTRY TYPES
26  *************************************************************************)
27
28 (* View: sto_bool
29     Store a boolean value *)
30 let sto_bool = store ("on"|"off")
31
32 (* View: sto_bool_warn
33     Store a boolean value *)
34 let sto_bool_warn = store ("on"|"off"|"warn"|"nowarn")
35
36 (* View: bool
37     A boolean switch *)
38 let bool (kw:regexp) = Build.key_value_line kw Sep.space sto_bool
39
40 (* View: bool_warn
41     A boolean switch with extended values *)
42 let bool_warn (kw:regexp) = Build.key_value_line kw Sep.space sto_bool_warn
43
44 (* View: list
45     A list of items *)
46 let list (kw:regexp) (elem:string) =
47   let list_elems = Build.opt_list [seq elem . store Rx.word] (Sep.comma . Sep.opt_space) in
48   Build.key_value_line kw Sep.space list_elems
49
50 (* View: trim *)
51 let trim =
52   let trim_list = Build.opt_list [seq "trim" . store Rx.word] (del /[:;,]/ ":") in
53   Build.key_value_line "trim" Sep.space trim_list
54
55 (* View: entry *)
56 let entry = bool ("multi"|"nospoof"|"spoofalert"|"reorder")
57           | bool_warn "spoof"
58           | list "order" "order"
59           | trim
60
61 (************************************************************************
62  * Group:                 LENS AND FILTER
63  *************************************************************************)
64
65 (* View: lns *)
66 let lns = ( Util.empty | Util.comment | entry )*
67
68 (* View: filter *)
69 let filter = incl "/etc/host.conf"
70
71 let xfm = transform lns filter