197049Speter#! /bin/sh
2166124Srafan# $Id: MKkeys_list.sh,v 1.4 2003/10/25 16:19:54 tom Exp $
397049Speter##############################################################################
4166124Srafan# Copyright (c) 2001,2003 Free Software Foundation, Inc.                     #
597049Speter#                                                                            #
697049Speter# Permission is hereby granted, free of charge, to any person obtaining a    #
797049Speter# copy of this software and associated documentation files (the "Software"), #
897049Speter# to deal in the Software without restriction, including without limitation  #
997049Speter# the rights to use, copy, modify, merge, publish, distribute, distribute    #
1097049Speter# with modifications, sublicense, and/or sell copies of the Software, and to #
1197049Speter# permit persons to whom the Software is furnished to do so, subject to the  #
1297049Speter# following conditions:                                                      #
1397049Speter#                                                                            #
1497049Speter# The above copyright notice and this permission notice shall be included in #
1597049Speter# all copies or substantial portions of the Software.                        #
1697049Speter#                                                                            #
1797049Speter# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
1897049Speter# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
1997049Speter# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
2097049Speter# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
2197049Speter# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
2297049Speter# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
2397049Speter# DEALINGS IN THE SOFTWARE.                                                  #
2497049Speter#                                                                            #
2597049Speter# Except as contained in this notice, the name(s) of the above copyright     #
2697049Speter# holders shall not be used in advertising or otherwise to promote the sale, #
2797049Speter# use or other dealings in this Software without prior written               #
2897049Speter# authorization.                                                             #
2997049Speter##############################################################################
3097049Speter#
3197049Speter# MKkey_defs.sh -- generate list of function-keys for terminfo database
3297049Speter#
33166124Srafan# Author: Thomas E. Dickey 2001
3497049Speter#
3597049Speter# Extract function-key names from the Caps file
3697049Speter#
3797049Speter: ${AWK-awk}
3897049SpeterDATA=${1-../../include/Caps}
3997049Speter
4097049Speterdata=data$$
4197049Spetertrap 'rm -f $data' 0 1 2 5 15
42166124Srafansed -e 's/[	][	]*/	/g' < $DATA >$data
4397049Speter
4497049Spetercat <<EOF
4597049Speter# These definitions were generated by $0 $DATA
4697049SpeterKEY_BREAK
4797049SpeterKEY_SRESET
4897049SpeterKEY_RESET
4997049SpeterKEY_RESIZE
5097049SpeterEOF
5197049Speter
5297049Speter${AWK-awk} <$data '
5397049Speter/^#/		{next;}
5497049Speter/^capalias/	{next;}
5597049Speter/^infoalias/	{next;}
5697049Speter
5797049Speter$5 != "-" {
5897049Speter		if (substr($5, 1, 4) == "KEY_" ) {
5997049Speter			printf "%s	%s\n", $5, $1
6097049Speter	}
6197049Speter}
6297049Speter'
63