|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: Getcap
|
|
Packit Service |
a2ae7a |
Parses generic termcap-style capability databases
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Author: Matt Dainty <matt@bodgit-n-scarper.com>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Reference
|
|
Packit Service |
a2ae7a |
- man 3 getcap
|
|
Packit Service |
a2ae7a |
- man 5 login.conf
|
|
Packit Service |
a2ae7a |
- man 5 printcap
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Each line represents a record consisting of a number of ':'-separated fields
|
|
Packit Service |
a2ae7a |
the first of which is the name or identifier for the record. The name can
|
|
Packit Service |
a2ae7a |
optionally be split by '|' and each subsequent value is considered an alias
|
|
Packit Service |
a2ae7a |
of the first. Records can be split across multiple lines with '\'.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
See also the Rtadvd and Termcap modules which contain slightly more specific
|
|
Packit Service |
a2ae7a |
grammars.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module Getcap =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Comments cannot have any leading characters *)
|
|
Packit Service |
a2ae7a |
let comment = Util.comment_generic /#[ \t]*/ "# "
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let nfield = /[^#:\\\\\t\n|][^:\\\\\t\n|]*/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* field must not contain ':' *)
|
|
Packit Service |
a2ae7a |
let cfield = /[a-zA-Z0-9-]+([%^$#\\]?@|[%^$#\\=]([^:\\\\^]|\\\\[0-7]{1,3}|\\\\[bBcCeEfFnNrRtT\\^]|\^.)*)?/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let csep = del /:([ \t]*\\\\\n[ \t]*:)?/ ":\\\n\t:"
|
|
Packit Service |
a2ae7a |
let nsep = Util.del_str "|"
|
|
Packit Service |
a2ae7a |
let name = [ label "name" . store nfield ]
|
|
Packit Service |
a2ae7a |
let capability (re:regexp) = [ label "capability" . store re ]
|
|
Packit Service |
a2ae7a |
let record (re:regexp) = [ label "record" . name . ( nsep . name )* . ( csep . capability re )* . Sep.colon . Util.eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let lns = ( Util.empty | comment | record cfield )*
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let filter = incl "/etc/login.conf"
|
|
Packit Service |
a2ae7a |
. incl "/etc/printcap"
|
|
Packit Service |
a2ae7a |
. Util.stdexcl
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Local Variables: *)
|
|
Packit Service |
a2ae7a |
(* mode: caml *)
|
|
Packit Service |
a2ae7a |
(* End: *)
|