166963Speter#! /bin/sh 2166124Srafan# $Id: MKncurses_def.sh,v 1.2 2003/10/25 16:19:46 tom Exp $ 366963Speter############################################################################## 466963Speter# Copyright (c) 2000 Free Software Foundation, Inc. # 566963Speter# # 666963Speter# Permission is hereby granted, free of charge, to any person obtaining a # 766963Speter# copy of this software and associated documentation files (the "Software"), # 866963Speter# to deal in the Software without restriction, including without limitation # 966963Speter# the rights to use, copy, modify, merge, publish, distribute, distribute # 1066963Speter# with modifications, sublicense, and/or sell copies of the Software, and to # 1166963Speter# permit persons to whom the Software is furnished to do so, subject to the # 1266963Speter# following conditions: # 1366963Speter# # 1466963Speter# The above copyright notice and this permission notice shall be included in # 1566963Speter# all copies or substantial portions of the Software. # 1666963Speter# # 1766963Speter# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 1866963Speter# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 1966963Speter# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 2066963Speter# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 2166963Speter# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 2266963Speter# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 2366963Speter# DEALINGS IN THE SOFTWARE. # 2466963Speter# # 2566963Speter# Except as contained in this notice, the name(s) of the above copyright # 2666963Speter# holders shall not be used in advertising or otherwise to promote the sale, # 2766963Speter# use or other dealings in this Software without prior written # 2866963Speter# authorization. # 2966963Speter############################################################################## 3066963Speter# 3166963Speter# MKncurses_def.sh -- generate fallback definitions for ncurses_cfg.h 3266963Speter# 33166124Srafan# Author: Thomas E. Dickey 2000 3466963Speter# 3566963Speter# Given the choice between constructs such as 3666963Speter# 3766963Speter# #if defined(foo) && foo 3866963Speter# #if foo 3966963Speter# 4066963Speter# we chose the latter. It is guaranteed by the language standard, and there 4166963Speter# appear to be no broken compilers that do not honor that detail. But some 4266963Speter# people want to use gcc's -Wundef option (corresponding to one of the less 4366963Speter# useful features in Watcom's compiler) to check for misspellings. So we 4466963Speter# generate a set of fallback definitions to quiet the warnings without making 4566963Speter# the code ugly. 4666963Speter# 4766963SpeterDEFS="${1-ncurses_defs}" 4866963Spetercat <<EOF 4966963Speter/* 5066963Speter * This file is generated by $0 5166963Speter */ 5266963Speter 5366963Speter#ifndef NC_DEFINE_H 5466963Speter#define NC_DEFINE_H 1 5566963Speter 5666963SpeterEOF 5766963Speter 5866963Speter${AWK-awk} <$DEFS ' 5966963Speter!/^[@#]/ { 6066963Speter if ( NF == 1 ) 6166963Speter { 6266963Speter print "#ifndef", $1 6366963Speter print "#define", $1, "0" 6466963Speter print "#endif" 6566963Speter print "" 6666963Speter } else if ( NF != 0 ) { 6766963Speter print "#ifndef", $1 6866963Speter printf "#define" 6966963Speter for (n = 1; n <= NF; n++) { 7066963Speter printf " %s", $n 7166963Speter } 7266963Speter print "" 7366963Speter print "#endif" 7466963Speter print "" 7566963Speter } 7666963Speter} 7766963SpeterEND { 7866963Speterprint "#endif /* NC_DEFINE_H */" 7966963Speter } 8066963Speter' 81