1#!/bin/sh
2# $Id: MKparametrized.sh,v 1.5 2000/10/01 00:57:24 tom Exp $
3#
4# MKparametrized.sh -- generate indirection vectors for various sort methods
5#
6# The output of this script is C source for an array specifying whether
7# termcap strings should undergo parameter and padding translation.
8#
9CAPS="${1-Caps}"
10cat <<EOF
11/*
12 * parametrized.h --- is a termcap capability parametrized?
13 *
14 * Note: this file is generated using MKparametrized.sh, do not edit by hand.
15 * A value of -1 in the table means suppress both pad and % translations.
16 * A value of 0 in the table means do pad but not % translations.
17 * A value of 1 in the table means do both pad and % translations.
18 */
19
20static short const parametrized[] = {
21EOF
22
23# We detect whether % translations should be done by looking for #[0-9] in the
24# description field.  We presently suppress padding translation only for the
25# XENIX acs_* capabilities.  Maybe someday we'll dedicate a flag field for
26# this, that would be cleaner....
27
28${AWK-awk} <$CAPS '
29$3 != "str"	{next;}
30$1 ~ /^acs_/	{print "-1,\t/* ", $2, " */"; count++; next;}
31$0 ~ /#[0-9]/	{print "1,\t/* ", $2, " */"; count++; next;}
32		{print "0,\t/* ", $2, " */"; count++;}
33END		{printf("} /* %d entries */;\n\n", count);}
34'
35
36