Imported Upstream version 1.7.0
[platform/upstream/augeas.git] / lenses / ethers.aug
1 (* Parsing /etc/ethers *)
2
3 module Ethers =
4   autoload xfm
5
6   let sep_tab = Util.del_ws_tab
7
8   let eol = del /[ \t]*\n/ "\n"
9   let indent = del /[ \t]*/ ""
10
11   let comment = Util.comment
12   let empty   = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
13
14   let word = /[^# \n\t]+/
15   let address =
16     let hex = /[0-9a-fA-F][0-9a-fA-F]?/ in
17       hex . ":" . hex . ":" . hex . ":" . hex . ":" . hex . ":" . hex
18
19   let record = [ seq "ether" . indent .
20                               [ label "mac" . store  address ] . sep_tab .
21                               [ label "ip" . store word ] . eol ]
22
23   let lns = ( empty | comment | record ) *
24
25   let xfm = transform lns (incl "/etc/ethers")