Imported Upstream version 1.3.0
[platform/upstream/augeas.git] / lenses / hosts.aug
1 (* Parsing /etc/hosts *)
2
3 module Hosts =
4   autoload xfm
5
6   let sep_tab = Util.del_ws_tab
7   let sep_spc = Util.del_ws_spc
8
9   let eol = Util.eol
10   let indent = Util.indent
11
12   let comment = Util.comment
13   let comment_or_eol = Util.comment_or_eol
14   let empty   = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
15
16   let word = /[^# \n\t]+/
17   let record = [ seq "host" . indent .
18                               [ label "ipaddr" . store  word ] . sep_tab .
19                               [ label "canonical" . store word ] .
20                               [ label "alias" . sep_spc . store word ]*
21                  . comment_or_eol ]
22
23   let lns = ( empty | comment | record ) *
24
25   let xfm = transform lns (incl "/etc/hosts")