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