Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / getcap.aug
1 (*
2 Module: Getcap
3   Parses generic termcap-style capability databases
4
5 Author: Matt Dainty <matt@bodgit-n-scarper.com>
6
7 About: Reference
8        - man 3 getcap
9        - man 5 login.conf
10        - man 5 printcap
11
12 Each line represents a record consisting of a number of ':'-separated fields
13 the first of which is the name or identifier for the record. The name can
14 optionally be split by '|' and each subsequent value is considered an alias
15 of the first. Records can be split across multiple lines with '\'.
16
17 See also the Rtadvd and Termcap modules which contain slightly more specific
18 grammars.
19
20 *)
21
22 module Getcap =
23   autoload xfm
24
25   (* Comments cannot have any leading characters *)
26   let comment                = Util.comment_generic /#[ \t]*/ "# "
27
28   let nfield                 = /[^#:\\\\\t\n|][^:\\\\\t\n|]*/
29
30   (* field must not contain ':' *)
31   let cfield                 = /[a-zA-Z0-9-]+([%^$#\\]?@|[%^$#\\=]([^:\\\\^]|\\\\[0-7]{1,3}|\\\\[bBcCeEfFnNrRtT\\^]|\^.)*)?/
32
33   let csep                   = del /:([ \t]*\\\\\n[ \t]*:)?/ ":\\\n\t:"
34   let nsep                   = Util.del_str "|"
35   let name                   = [ label "name" . store nfield ]
36   let capability (re:regexp) = [ label "capability" . store re ]
37   let record (re:regexp)     = [ label "record" . name . ( nsep . name )* . ( csep . capability re )* . Sep.colon . Util.eol ]
38
39   let lns = ( Util.empty | comment | record cfield )*
40
41   let filter = incl "/etc/login.conf"
42              . incl "/etc/printcap"
43              . Util.stdexcl
44
45   let xfm = transform lns filter
46
47 (* Local Variables: *)
48 (* mode: caml       *)
49 (* End:             *)