Annotation of src/usr.bin/getcap/getcap.1, Revision 1.5
1.5 ! millert 1: .\" $OpenBSD: getcap.1,v 1.4 2015/09/25 16:23:18 schwarze Exp $
1.1 millert 2: .\"
1.5 ! millert 3: .\" Copyright (c) 2005 Todd C. Miller <millert@openbsd.org>
1.1 millert 4: .\"
5: .\" Permission to use, copy, modify, and distribute this software for any
6: .\" purpose with or without fee is hereby granted, provided that the above
7: .\" copyright notice and this permission notice appear in all copies.
8: .\"
9: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16: .\"
1.5 ! millert 17: .Dd $Mdocdate: September 25 2015 $
1.1 millert 18: .Dt GETCAP 1
19: .Os
20: .Sh NAME
21: .Nm getcap
22: .Nd capability database access utility
23: .Sh SYNOPSIS
24: .Nm getcap
25: .Oo
26: .Fl b Ar boolean | Fl c Ar capability |
27: .Fl n Ar number | Fl s Ar string
28: .Oc
29: .Fl f Ar path
1.4 schwarze 30: .Fl a | Ar record ...
1.1 millert 31: .Sh DESCRIPTION
32: The
33: .Nm
1.2 jmc 34: utility provides a simple method for querying a capability database such as
1.1 millert 35: .Pa /etc/login.conf
36: or
37: .Pa /etc/printcap
38: and as described by
39: .Xr getcap 3 .
40: .Pp
41: The following query types are supported:
42: .Bl -tag -width "capability"
43: .It boolean
44: A boolean flag.
45: For each matching record, the name of the boolean capability is printed
46: (since there is no value per se).
47: .It number
48: A numeric capability (key#number).
49: For each matching record, the value of the numeric capability is printed
50: as a decimal number.
51: To print a number in the same format as it is listed in the
52: capabilities database (i.e. literally), use a
53: .Dq raw
54: query instead.
55: .It string
56: A string capability (key=value).
1.2 jmc 57: Note that the value printed has escape sequences expanded: see
1.1 millert 58: .Xr getcap 3
59: for a list of valid escape sequences.
60: To print the string exactly as it is listed in the
1.2 jmc 61: capabilities database, use a
1.1 millert 62: .Dq raw
63: query instead.
64: .It raw
65: A generic query where no interpretation of the data is done.
66: Use this for querying capabilities with non-standard types or
67: for getting the raw, unformatted entry from the database.
68: .El
69: .Pp
70: .Nm
1.2 jmc 71: prints the value associated with the given key.
1.1 millert 72: If more than one record is being searched, the value is prefixed
73: with the record name (for records with multiple names, only the
74: first is printed).
75: If a key has no associated value and a boolean query is not being
76: performed, a blank line will be printed.
77: .Pp
78: The options are as follows:
79: .Bl -tag -width "-c capability"
80: .It Fl a
81: Query all records in the database.
82: .It Fl b Ar boolean
83: Return occurrences of
84: .Ar boolean .
85: .It Fl c Ar capability
86: Return the raw value for the key
87: .Ar capability ,
1.2 jmc 88: which must include the type as the last character, e.g.\&
1.1 millert 89: .Dq foo=
90: for the string
91: .Sq foo .
92: See
93: .Xr getcap 3
94: for more information on capability types.
95: .It Fl f Ar path
96: A colon-separated list of database filenames to be searched for records.
97: .It Fl n Ar number
98: Return occurrences of
99: .Ar number .
100: .It Fl s Ar string
101: Return occurrences of the string
102: .Ar string .
103: .El
104: .Pp
105: Only one of the
106: .Fl b ,
107: .Fl c ,
1.2 jmc 108: .Fl n ,
1.1 millert 109: and
1.2 jmc 110: .Fl s
1.1 millert 111: options may be specified.
1.2 jmc 112: If none are specified, the record will be dumped from the database as is.
1.1 millert 113: .Sh FILES
1.2 jmc 114: .Bl -tag -width "/etc/login.confXX" -compact
1.1 millert 115: .It Pa /etc/login.conf
116: login configuration
117: .It Pa /etc/printcap
118: printer configuration
119: .It Pa /etc/termcap
120: terminal configuration
121: .El
122: .Sh EXAMPLES
123: Find all
124: .Xr login.conf 5
125: entries with the
126: .Dq ignorenologin
127: capability:
128: .Pp
129: .Dl "$ getcap -f /etc/login.conf -a -b ignorenologin"
130: .Pp
131: Dump the
132: .Dq default
1.2 jmc 133: record in
1.1 millert 134: .Xr login.conf 5 :
135: .Pp
136: .Dl "$ getcap -f /etc/login.conf default"
137: .Pp
138: Print all
1.2 jmc 139: .Xr login.conf 5
1.1 millert 140: records with the
141: .Dq localcipher
142: capability:
143: .Pp
144: .Dl "$ getcap -f /etc/login.conf -a -s localcipher"
145: .Pp
146: Print the
147: .Dq datasize-max
148: capability in the
149: .Dq staff
150: record in
151: .Xr login.conf 5
152: if it exists:
153: .Pp
154: .Dl "$ getcap -f /etc/login.conf -s datasize-max staff"
155: .Pp
156: Print all
157: .Xr printcap 5
158: entries that reference
159: .Pa /dev/lp .
160: Note that we are treating the entire string
161: .Dq lp=/dev/lp
162: as a boolean flag instead of a key/value pair.
163: .Pp
164: .Dl "$ getcap -f /etc/printcap -a -b lp=/dev/lp"
165: .Sh SEE ALSO
166: .Xr cap_mkdb 1 ,
167: .Xr getcap 3 ,
168: .Xr login.conf 5 ,
169: .Xr printcap 5 ,
170: .Xr termcap 5
171: .Sh HISTORY
172: The
173: .Nm
174: command appeared in
175: .Ox 3.7 .
176: .Sh AUTHORS
1.2 jmc 177: .An Todd C. Miller