adding GNU dc ("desk calculator")
[unix-history] / usr.sbin / keymap / lib / keycap.3
CommitLineData
15637ed4
RG
1.\" Contributed to 386bsd 0.1 and later versions
2.\"
3.\" Copyright 1992 by Holger Veit
4.\" May be freely used with Bill Jolitz's port of
5.\" 386bsd and may be included in a 386bsd collection
6.\" as long as binary and source are available and reproduce the above
7.\" copyright.
8.\"
9.\" You may freely modify this code and contribute improvements based
10.\" on this code as long as you don't claim to be the original author.
11.\" Commercial use of this source requires permittance of the copyright
12.\" holder. A general license for 386bsd will override this restriction.
13.\"
14.\" Use at your own risk. The copyright holder or any person who makes
15.\" this code available for the public (administrators of public archives
16.\" for instance) are not responsible for any harm to hardware or software
17.\" that might happen due to wrong application or program faults.
18.\"
19.\" You must have the codriver driver in the same package generated
20.\" into the 386bsd kernel, otherwise this program does not work.
21.\"
22.\" @(#)keycap.3 1.0 (contributed to 386bsd) 10/25/92
23.\"
24.Dd October 25, 1992
25.Dt CONSUTIL 3
26.Os 386bsd 0.2
27.Sh NAME
28.Nm kgetent ,
29.Nm kgetnum ,
30.Nm kgetflag ,
31.Nm kgetstr
32.Nd keyboard independent operation routines
33.Sh SYNOPSIS
34.Fn kgetent "char *bp" "char *name"
35.Fn kgetnum "char *id"
36.Fn kgetflag "char *id"
37.Ft char *
38.Fn kgetstr "char *id" "char *area"
39.Sh DESCRIPTION
40These functions extract and use capabilities from a keyboard capability data
41base, usually
42.Pa /usr/share/misc/keycap ,
43the format of which is described in
44.Xr keycap 5 .
45.Pp
46The
47.Fn kgetent
48function
49extracts the entry for a keyboard entry
50.Fa name
51into the buffer at
52.Fa bp .
53The
54.Fa bp
55argument
56should be a character buffer of size
571024 and must be retained through all subsequent calls to
58.Fn kgetnum ,
59.Fn kgetflag ,
60and
61.Fn kgetstr .
62The
63.Fn kgetent
64function
65returns \-1 if none of the
66.Nm keycap
67data base files could be opened,
680 if the keyboard name given does not have an entry,
69and 1 if all goes well.
70It will look in the environment for a
71.Ev KEYCAP
72variable.
73If found, and the value does not begin with a slash,
74and the keyboard type
75.Fa name
76is the same as the environment string
77.Ev KEYBOARD ,
78the
79.Ev KEYCAP
80string is used instead of reading a
81.Nm keycap
82file.
83If it does begin with a slash, the string is used as a path name
84of the
85.Nm keycap
86file to search.
87If
88.Ev KEYCAP
89does not begin with a slash,
90.Fn kgetent
91searches the file
92.Pp
93The
94.Fn kgetnum
95function
96gets the numeric value of capability
97.Fa id ,
98returning \-1 if is not given for the keyboard
99The
100.Fn kgetflag
101function
102returns 1 if the specified capability is present in
103the keyboard's entry, 0 if it is not.
104The
105.Fn kgetstr
106function
107returns the string value of the capability
108.Fa id ,
109places it in the buffer at
110.Fa area ,
111and advances the
112.Fa area
113pointer.
114It decodes the abbreviations for this field described in
115.Xr keycap 5 .
116The
117.Fn kgetstr
118function
119returns
120.Dv NULL
121if the capability was not found.
122.Pp
123.Sh FILES
124.Bl -tag -width /usr/share/misc/keycap -compact
125.It Pa /usr/lib/libconsutil.a
126.Fl l Ar consutil
127keycap utilities library
128.It Pa /usr/share/misc/keycap
129standard keyboard capability data base
130.El
131.Sh SEE ALSO
132.Xr co 4 ,
133.Xr keycap 5
134.Sh HISTORY
135The
136.Nm
137keyboard capability data base is a new feature of 386bsd 0.2 and later.