150276Speter#!/bin/sh
2166124Srafan##############################################################################
3166124Srafan# Copyright (c) 1998-2000,2006 Free Software Foundation, Inc.                #
4166124Srafan#                                                                            #
5166124Srafan# Permission is hereby granted, free of charge, to any person obtaining a    #
6166124Srafan# copy of this software and associated documentation files (the "Software"), #
7166124Srafan# to deal in the Software without restriction, including without limitation  #
8166124Srafan# the rights to use, copy, modify, merge, publish, distribute, distribute    #
9166124Srafan# with modifications, sublicense, and/or sell copies of the Software, and to #
10166124Srafan# permit persons to whom the Software is furnished to do so, subject to the  #
11166124Srafan# following conditions:                                                      #
12166124Srafan#                                                                            #
13166124Srafan# The above copyright notice and this permission notice shall be included in #
14166124Srafan# all copies or substantial portions of the Software.                        #
15166124Srafan#                                                                            #
16166124Srafan# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
17166124Srafan# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
18166124Srafan# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
19166124Srafan# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
20166124Srafan# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
21166124Srafan# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
22166124Srafan# DEALINGS IN THE SOFTWARE.                                                  #
23166124Srafan#                                                                            #
24166124Srafan# Except as contained in this notice, the name(s) of the above copyright     #
25166124Srafan# holders shall not be used in advertising or otherwise to promote the sale, #
26166124Srafan# use or other dealings in this Software without prior written               #
27166124Srafan# authorization.                                                             #
28166124Srafan##############################################################################
29166124Srafan# $Id: MKparametrized.sh,v 1.6 2006/04/22 21:36:16 tom Exp $
3050276Speter#
3150276Speter# MKparametrized.sh -- generate indirection vectors for various sort methods
3250276Speter#
3350276Speter# The output of this script is C source for an array specifying whether
3450276Speter# termcap strings should undergo parameter and padding translation.
3550276Speter#
3650276SpeterCAPS="${1-Caps}"
3750276Spetercat <<EOF
3850276Speter/*
3950276Speter * parametrized.h --- is a termcap capability parametrized?
4050276Speter *
4166963Speter * Note: this file is generated using MKparametrized.sh, do not edit by hand.
4250276Speter * A value of -1 in the table means suppress both pad and % translations.
4350276Speter * A value of 0 in the table means do pad but not % translations.
4450276Speter * A value of 1 in the table means do both pad and % translations.
4550276Speter */
4650276Speter
4750276Speterstatic short const parametrized[] = {
4850276SpeterEOF
4950276Speter
5050276Speter# We detect whether % translations should be done by looking for #[0-9] in the
5150276Speter# description field.  We presently suppress padding translation only for the
5250276Speter# XENIX acs_* capabilities.  Maybe someday we'll dedicate a flag field for
5350276Speter# this, that would be cleaner....
5450276Speter
5550276Speter${AWK-awk} <$CAPS '
5650276Speter$3 != "str"	{next;}
5750276Speter$1 ~ /^acs_/	{print "-1,\t/* ", $2, " */"; count++; next;}
5850276Speter$0 ~ /#[0-9]/	{print "1,\t/* ", $2, " */"; count++; next;}
5950276Speter		{print "0,\t/* ", $2, " */"; count++;}
6050276SpeterEND		{printf("} /* %d entries */;\n\n", count);}
6150276Speter'
6250276Speter
63