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