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 
  39 BEGIN {
  40 print "/*"
  41 print " * Copyright (c) 1998 by Sun Microsystems, Inc."
  42 print " * All rights reserved."
  43 print " */"
  44 print
  45 print "#pragma ident    \"@(#)keyindex.c\t%I%\t%E% SMI\""
  46 print
  47 print "/*"
  48 print " * keyindex.c"
  49 print " *"
  50 print " * XCurses Library"
  51 print " *"
  52 print " * **** THIS FILE IS MACHINE GENERATED."
  53 print " * **** DO NOT EDIT THIS FILE."
  54 print " *"
  55 print " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved."
  56 print " *"
  57 print " */"
  58 print
  59 print "#include <private.h>"
  60 print
  61 print "/*"
  62 print " * This table is used to map a KEY_ constant to an"
  63 print " * index for cur_term->_str[] for use by keyname()."
  64 print " */"
  65 print "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 
  77 END {
  78         print "\t{ -1, -1 }"
  79         print "};"
  80 }