1.\" $OpenBSD: getcap.1,v 1.3 2007/05/31 19:20:10 jmc Exp $ 2.\" 3.\" Copyright (c) 2005 Todd C. Miller <Todd.Miller@courtesan.com> 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.\" 17.Dd $Mdocdate: May 31 2007 $ 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 a 30.Fl f Ar path 31.Nm getcap 32.Oo 33.Fl b Ar boolean | Fl c Ar capability | 34.Fl n Ar number | Fl s Ar string 35.Oc 36.Fl f Ar path 37record ... 38.Sh DESCRIPTION 39The 40.Nm 41utility provides a simple method for querying a capability database such as 42.Pa /etc/login.conf 43or 44.Pa /etc/printcap 45and as described by 46.Xr getcap 3 . 47.Pp 48The following query types are supported: 49.Bl -tag -width "capability" 50.It boolean 51A boolean flag. 52For each matching record, the name of the boolean capability is printed 53(since there is no value per se). 54.It number 55A numeric capability (key#number). 56For each matching record, the value of the numeric capability is printed 57as a decimal number. 58To print a number in the same format as it is listed in the 59capabilities database (i.e. literally), use a 60.Dq raw 61query instead. 62.It string 63A string capability (key=value). 64Note that the value printed has escape sequences expanded: see 65.Xr getcap 3 66for a list of valid escape sequences. 67To print the string exactly as it is listed in the 68capabilities database, use a 69.Dq raw 70query instead. 71.It raw 72A generic query where no interpretation of the data is done. 73Use this for querying capabilities with non-standard types or 74for getting the raw, unformatted entry from the database. 75.El 76.Pp 77.Nm 78prints the value associated with the given key. 79If more than one record is being searched, the value is prefixed 80with the record name (for records with multiple names, only the 81first is printed). 82If a key has no associated value and a boolean query is not being 83performed, a blank line will be printed. 84.Pp 85The options are as follows: 86.Bl -tag -width "-c capability" 87.It Fl a 88Query all records in the database. 89.It Fl b Ar boolean 90Return occurrences of 91.Ar boolean . 92.It Fl c Ar capability 93Return the raw value for the key 94.Ar capability , 95which must include the type as the last character, e.g.\& 96.Dq foo= 97for the string 98.Sq foo . 99See 100.Xr getcap 3 101for more information on capability types. 102.It Fl f Ar path 103A colon-separated list of database filenames to be searched for records. 104.It Fl n Ar number 105Return occurrences of 106.Ar number . 107.It Fl s Ar string 108Return occurrences of the string 109.Ar string . 110.El 111.Pp 112Only one of the 113.Fl b , 114.Fl c , 115.Fl n , 116and 117.Fl s 118options may be specified. 119If none are specified, the record will be dumped from the database as is. 120.Sh FILES 121.Bl -tag -width "/etc/login.confXX" -compact 122.It Pa /etc/login.conf 123login configuration 124.It Pa /etc/printcap 125printer configuration 126.It Pa /etc/termcap 127terminal configuration 128.El 129.Sh EXAMPLES 130Find all 131.Xr login.conf 5 132entries with the 133.Dq ignorenologin 134capability: 135.Pp 136.Dl "$ getcap -f /etc/login.conf -a -b ignorenologin" 137.Pp 138Dump the 139.Dq default 140record in 141.Xr login.conf 5 : 142.Pp 143.Dl "$ getcap -f /etc/login.conf default" 144.Pp 145Print all 146.Xr login.conf 5 147records with the 148.Dq localcipher 149capability: 150.Pp 151.Dl "$ getcap -f /etc/login.conf -a -s localcipher" 152.Pp 153Print the 154.Dq datasize-max 155capability in the 156.Dq staff 157record in 158.Xr login.conf 5 159if it exists: 160.Pp 161.Dl "$ getcap -f /etc/login.conf -s datasize-max staff" 162.Pp 163Print all 164.Xr printcap 5 165entries that reference 166.Pa /dev/lp . 167Note that we are treating the entire string 168.Dq lp=/dev/lp 169as a boolean flag instead of a key/value pair. 170.Pp 171.Dl "$ getcap -f /etc/printcap -a -b lp=/dev/lp" 172.Sh SEE ALSO 173.Xr cap_mkdb 1 , 174.Xr getcap 3 , 175.Xr login.conf 5 , 176.Xr printcap 5 , 177.Xr termcap 5 178.Sh HISTORY 179The 180.Nm 181command appeared in 182.Ox 3.7 . 183.Sh AUTHORS 184.An Todd C. Miller 185