Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / samba.aug
1 (* Samba module for Augeas
2    Author: Free Ekanayaka <free@64studio.com>
3
4    Reference: man smb.conf(5)
5
6 *)
7
8
9 module Samba =
10   autoload xfm
11
12 (************************************************************************
13  * INI File settings
14  *************************************************************************)
15
16 let comment  = IniFile.comment IniFile.comment_re IniFile.comment_default
17 let sep      = del /[ \t]*=/ " ="
18 let indent   = del /[ \t]*/ "   "
19
20 (* Import useful INI File primitives *)
21 let eol      = IniFile.eol
22 let empty    = IniFile.empty
23 let sto_to_comment
24              = Util.del_opt_ws " "
25              . store /[^;# \t\r\n][^;#\r\n]*[^;# \t\r\n]|[^;# \t\r\n]/
26
27 (************************************************************************
28  *                        ENTRY
29  * smb.conf allows indented entries
30  *************************************************************************)
31
32 let entry_re = /[A-Za-z0-9_.-][A-Za-z0-9 _.:\*-]*[A-Za-z0-9_.\*-]/
33 let entry    = let kw = entry_re in
34              [ indent
35              . key kw
36              . sep
37              . sto_to_comment?
38              . (comment|eol) ]
39              | comment
40
41 (************************************************************************
42  *                         TITLE
43  *************************************************************************)
44
45 let title    = IniFile.title_label "target" IniFile.record_label_re
46 let record   = IniFile.record title entry
47
48 (************************************************************************
49  *                         LENS & FILTER
50  *************************************************************************)
51
52 let lns      = IniFile.lns record comment
53
54 let filter   = (incl "/etc/samba/smb.conf")
55
56 let xfm = transform lns filter