1#
2# CDDL HEADER START
3#
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
7# with the License.
8#
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.
13#
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]
19#
20# CDDL HEADER END
21#
22# Copyright (c) 1995-1998 by Sun Microsystems, Inc.
23# All rights reserved.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# mkkey.awk
28#
29# XCurses Library
30#
31# Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
32#
33# USAGE:
34# 	awk -f mkkey.awk caps >keyindex.c
35#
36#  rcsid = $Header: /rd/src/libc/xcurses/rcs/mkkey.awk 1.1 1995/05/11 14:39:17 ant Exp $
37#
38
39BEGIN {
40print "/*"
41print " * Copyright (c) 1998 by Sun Microsystems, Inc."
42print " * All rights reserved."
43print " */"
44print ""
45print "#pragma ident	\"@(#)keyindex.c\t%I%\t%E% SMI\""
46print ""
47print "/*"
48print " * keyindex.c"
49print " *"
50print " * XCurses Library"
51print " *"
52print " * **** THIS FILE IS MACHINE GENERATED."
53print " * **** DO NOT EDIT THIS FILE."
54print " *"
55print " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved."
56print " *"
57print " */"
58print ""
59print "#include <private.h>"
60print ""
61print "/*"
62print " * This table is used to map a KEY_ constant to an"
63print " * index for cur_term->_str[] for use by keyname()."
64print " */"
65print "const short	__m_keyindex[][2] = {"
66	strcount = 0;
67}
68
69$4 == "str" {
70	if ($1 ~ /^key_f[0-9][0-9]*/)
71		printf("\t{ %d, KEY_F(%d) },\n", strcount, substr($1, 6, 2));
72	else if ($1 ~ /^key_/)
73		printf "\t{ %d, %s },\n", strcount, toupper($1);
74	++strcount;
75}
76
77END {
78	print "\t{ -1, -1 }"
79	print "};"
80}
81