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 
  37 BEGIN {
  38 print "/*"
  39 print " * Copyright (c) 1998 by Sun Microsystems, Inc."
  40 print " * All rights reserved."
  41 print " */"
  42 print ""
  43 print "#pragma ident    \"@(#)keyindex.c\t%I%\t%E% SMI\""
  44 print ""
  45 print "/*"
  46 print " * keyindex.c"
  47 print " *"
  48 print " * XCurses Library"
  49 print " *"
  50 print " * **** THIS FILE IS MACHINE GENERATED."
  51 print " * **** DO NOT EDIT THIS FILE."
  52 print " *"
  53 print " * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved."
  54 print " *"
  55 print " */"
  56 print ""
  57 print "#include <private.h>"
  58 print ""
  59 print "/*"
  60 print " * This table is used to map a KEY_ constant to an"
  61 print " * index for cur_term->_str[] for use by keyname()."
  62 print " */"
  63 print "const short      __m_keyindex[][2] = {"
  64         strcount = 0;
  65 }
  66 
  67 $4 == "str" {
  68         if ($1 ~ /^key_f[0-9][0-9]*/)
  69                 printf("\t{ %d, KEY_F(%d) },\n", strcount, substr($1, 6, 2));
  70         else if ($1 ~ /^key_/)
  71                 printf "\t{ %d, %s },\n", strcount, toupper($1);
  72         ++strcount;
  73 }
  74 
  75 END {
  76         print "\t{ -1, -1 }"
  77         print "};"
  78 }