2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License, Version 1.0 only
2N/A# (the "License"). You may not use this file except in compliance
2N/A# with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
2N/A#
2N/A# Copyright 1997 Sun Microsystems, Inc. All rights reserved.
2N/A# Use is subject to license terms.
2N/A#
2N/A
2N/A#
2N/A# Copyright (c) 1988 AT&T
2N/A# All Rights Reserved
2N/A#
2N/A
2N/A#
2N/A# University Copyright- Copyright (c) 1982, 1986, 1988
2N/A# The Regents of the University of California
2N/A# All Rights Reserved
2N/A#
2N/A# University Acknowledgment- Portions of this document are derived from
2N/A# software developed by the University of California, Berkeley, and its
2N/A# contributors.
2N/A#
2N/A
2N/A#ident "%Z%%M% %I% %E% SMI"
2N/A
2N/Arm -f keyname.c
2N/A/usr/bin/echo "#include \"curses_inc.h\"\n" > keyname.c
2N/A/usr/bin/echo "static char *keystrings[] =\n\t\t{" >> keyname.c
2N/A{
2N/A grep -v 'KEY_F(' keycaps | awk '{ print $5, $4 }' | sed -e 's/,//g' -e 's/KEY_//'
2N/A # These three aren't in keycaps
2N/A echo '0401 BREAK\n0530 SRESET\n0531 RESET'
2N/A} | sort -n | awk '
2N/A {
2N/A print "\t\t \"" $2 "\", /* " $1 " */"
2N/A }
2N/A' >> keyname.c
2N/A
2N/ALAST=`tail -1 keyname.c | awk -F'"' '{print $2}'`
2N/Acat << ! >> keyname.c
2N/A };
2N/A
2N/Achar *
2N/Akeyname(int key)
2N/A{
2N/A static char buf[16];
2N/A
2N/A if (key >= 0400) {
2N/A int i;
2N/A
2N/A if ((key == 0400) || (key > KEY_${LAST}))
2N/A return ("UNKNOWN KEY");
2N/A if (key > 0507)
2N/A i = key - (0401 + ((0507 - 0410) + 1));
2N/A else
2N/A if (key >= 0410) {
2N/A (void) sprintf(buf, "KEY_F(%d)", key - 0410);
2N/A goto ret_buf;
2N/A } else
2N/A i = key - 0401;
2N/A (void) sprintf(buf, "KEY_%s", keystrings[i]);
2N/A goto ret_buf;
2N/A }
2N/A
2N/A if (key >= 0200) {
2N/A#ifdef SYSV
2N/A if (SHELLTTYS.c_cflag & CS8)
2N/A#else /* SYSV */
2N/A if (SHELLTTY.c_cflag & CS8)
2N/A#endif /* SYSV */
2N/A (void) sprintf(buf, "%c", key);
2N/A else
2N/A (void) sprintf(buf, "M-%s", unctrl(key & 0177));
2N/A goto ret_buf;
2N/A }
2N/A
2N/A if (key < 0) {
2N/A (void) sprintf(buf, "%d", key);
2N/Aret_buf:
2N/A return (buf);
2N/A }
2N/A
2N/A return (unctrl(key));
2N/A}
2N/A!
2N/Aexit 0