4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License, Version 1.0 only
6 # (the "License"). You may not use this file except in compliance
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright 2015 Gary Mills
24 # Copyright 1997 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 1988 AT&T
34 # University Copyright- Copyright (c) 1982, 1986, 1988
35 # The Regents of the University of California
38 # University Acknowledgment- Portions of this document are derived from
39 # software developed by the University of California, Berkeley, and its
44 /usr
/bin
/print
"#include \"curses_inc.h\"\n" > keyname.c
45 /usr
/bin
/print
"static char *keystrings[] =\n\t\t{" >> keyname.c
47 grep -v 'KEY_F(' keycaps |
awk '{ print $5, $4 }' |
sed -e 's/,//g' -e 's/KEY_//'
48 # These three aren't in keycaps
49 echo '0401 BREAK\n0530 SRESET\n0531 RESET'
52 print "\t\t \"" $2 "\", /* " $1 " */"
56 LAST
=`tail -1 keyname.c | awk -F'"' '{print $2}'`
68 if ((key
== 0400) ||
(key
> KEY_
${LAST}))
69 return ("UNKNOWN KEY");
71 i
= key
- (0401 + ((0507 - 0410) + 1));
74 (void
) sprintf
(buf
, "KEY_F(%d)", key
- 0410);
78 (void
) sprintf
(buf
, "KEY_%s", keystrings
[i
]);
84 if (SHELLTTYS.c_cflag
& CS8
)
86 if (SHELLTTY.c_cflag
& CS8
)
88 (void
) sprintf
(buf
, "%c", key
);
90 (void
) sprintf
(buf
, "M-%s", unctrl
(key
& 0177));
95 (void
) sprintf
(buf
, "%d", key
);
100 return (unctrl
(key
));