conf.sh revision 7c2fbfb345896881c631598ee3852ce9ce33fb07
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin########################################################################
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# This software is part of the ast package #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# Copyright (c) 1985-2008 AT&T Intellectual Property #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# and is licensed under the #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Common Public License, Version 1.0 #
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# by AT&T Intellectual Property #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# A copy of the License is available at #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Information and Software Systems Research #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# AT&T Research #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Florham Park NJ #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Glenn Fowler <gsf@research.att.com> #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# David Korn <dgk@research.att.com> #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# Phong Vo <kpv@research.att.com> #
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin########################################################################
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# @(#)conf.sh (AT&T Research) 2008-01-31
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# this script generates these files from the table file in the first arg
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# the remaining args are the C compiler name and flags
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# conflim.h supplemental limits.h definitions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# conftab.h readonly string table definitions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# conftab.c readonly string table data
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# you may think it should be simpler
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# but you shall be confused anyway
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin*x*:[0123456789]*) : bash set -x is broken :; set +ex ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinshell=`eval 'x=123&&integer n=\${#x}\${x#1?}&&((n==330/(10)))&&echo ksh' 2>/dev/null`
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin -*) echo "Usage: $command [-a] [-ccall-pattern] [-dN] [-l] [-nname_pattern] [-t] [-v] conf.tab" >&2; exit 2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) break ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsym=[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin1:?*) echo "$command: debug=$debug trace=$trace keep_call=$keep_call keep_name=$keep_name" >&2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if test ! -f $tab
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# determine the intmax_t printf format
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if _ast_intmax_long
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# determine the intmax_t constant suffix
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#if _ast_intmax_long
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin _ast_intmax_t s = 0x7fffffffffffffffLL;
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin unsigned _ast_intmax_t u = 0xffffffffffffffffLL;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# set up the names and keys
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) break ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ""|\#*) ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 0) break ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ":") shift
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while read line
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin "}") break ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *" -$f- "*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin printf "%29s %35s %8s %2s %1d %5s %s$nl" "$name" "$key" "$standard" "$call" "$section" "$flags" "$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if !defined(SYS_NMLEN)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define SYS_NMLEN 9
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# check for native getconf(1)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin : presumably an implementation also configured from conf.tab
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin1) echo "$command: check ${CONF_getconf:+$CONF_getconf(1),}confstr(2),pathconf(2),sysconf(2),sysinfo(2) configuration names" >&2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin -e '/^#[^0123456789]*1[ ]*".*".*/!d' \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin -e 's/^#[^0123456789]*1[ ]*"\(.*\)".*/\1/' |
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ?*) for v in `strings $CONF_getconf | grep '^[ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$'`
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin then echo $v
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinegrep -v '^_[ABCDEFGHIJKLMNOPQRSTUVWXYZ]+_(COUNT|LAST|N|STR)$' |
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinHOST=`package | sed -e 's,[0123456789.].*,,' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 0) continue ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do case $# in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue 2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin SET) continue ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin [0123456789]*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *[0123456789])
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin eval `echo $standard | sed 's,\(.*\)\([0123456789]*\),standard=\1 section=\2,'`
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin " C ") shift
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do case $# in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 0) break ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin CONFORMANCE|FS_3D|HOSTTYPE|LIBPATH|LIBPREFIX|LIBSUFFIX|PATH_ATTRIBUTES|PATH_RESOLVE|UNIVERSE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin V[123456789]_*|V[123456789][0123456789]_*) underscore=VW ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# sort keys by name
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin printf "%29s %35s %8s %2s %1d %5s %s$nl" "$name" "$key" "$standard" "$call" "$section" "$flags" "$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# mark the dups CONF_PREFIXED
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin '') continue
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case $p:$c in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *L*:*L*);;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *L*:*) c=L${c} ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *:*L*) p=L${p} ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) p=P$p c=P$c ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# collect all the macros/enums
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin '') continue ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) continue ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) continue ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) eval x='$'CONF_call_${c}_${standard}${section}_${name} ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do echo "_${c}_${name}"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) echo "_${c}_${standard}${section}_${name}" ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin echo "${conf_op}"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *:*L*) echo "${conf_name}"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin echo "_${standard}_${conf_name}"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) echo "_${standard}${section}_${conf_name}" ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# test all the macros in a few batches (some compilers have an error limit)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <unistd.h>$systeminfo$headers
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef conf
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if $cc -c $tmp.c > $tmp.e 2>&1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin then break
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin sed "s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g" $tmp.e |
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin grep '^[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*$' |
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin cmp -s $tmp.n $tmp.p && break
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin fgrep -x -v -f $tmp.n $1 > $tmp.y
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <unistd.h>$systeminfo$headers
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef conf
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin sed -e '/conf[ ]*".*"[ ]*=[ ]*/!d' -e '/[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][ ]*(/!d' -e 's/.*"\(.*\)".*/\1/' > $tmp.n
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if test -s $tmp.n
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin then fgrep -x -v -f $tmp.n $1 > $tmp.y
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin1) echo "$command: check macros/enums as static initializers" >&2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# mark the constant macros/enums
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# mark the string literal values
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <unistd.h>$systeminfo$headers
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef conf
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinsed -e '/conf[ ]*".*"[ ]*=[ ]*"/!d' -e 's/.*"\([^"]*\)".*/\1/' > $tmp.e
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# walk through the table
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) continue ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) continue ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) eval x='$'CONF_call_${c}_${standard}${section}_${name} ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) eval x='$'CONF_const__${c}_${standard}${section}_${name} ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for s in _${call}_${standard}${section}_${name} _${call}_${standard}_${name} _${call}_${section}_${name} _${call}_${name} ${call}_${name}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do case $s in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) x=$s ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin [0123456789]*|[-+][0123456789]*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case ${x:+1}:$flags:$conf_op in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin :*:-1|:*X*:*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1) echo "$command: probe for ${conf_name} <limits.h> value" >&2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case ${x:+1} in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <unistd.h>$systeminfo$headers
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) cat > $tmp.c <<!
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <unistd.h>$systeminfo$headers
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) $cc $a -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe > $tmp.x 2>/dev/null
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case ${x:+1}:$flags:$conf_op in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1:*:-1|1:*X*:*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1:*) cat >> $tmp.l <<!
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *:U*) cat >> $tmp.l <<!
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *:$sym) cat >> $tmp.l <<!
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) cat >> $tmp.l <<!
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) name=${section}_${name} ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do case $s in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do case $s in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case ${x:+1}:${script:+1} in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1) echo "$command: probe for _${standard}_${conf_name} minmax value" >&2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ?*) if $CONF_getconf _${standard}_${conf_name} > $tmp.x 2>/dev/null
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) cat > $tmp.c <<!
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <unistd.h>$systeminfo$headers
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) $cc $a -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe > $tmp.x 2>/dev/null
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 1) conf_limit="{ 0, $conf_limit }" conf_minmax="{ 0, $conf_minmax }"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 0[xX]*|-*|+*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *[!0123456789abcdefABCDEF]*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *[!0123456789]*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin 0[xX]*|-*|+*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *[!0123456789abcdefABCDEF]*)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *[!0123456789]*)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *[!lL][lL]|*[!lL][lL][uU])
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *) eval `echo '' $conf_limit | sed 's/ *\(.*\)\(.\) */p=\1 s=\2/'`
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin -*[0123456789])
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *[0123456789])
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *[!lL][lL]|*[!lL][lL][uU])
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *) eval `echo '' $conf_minmax | sed 's/ *\(.*\)\(.\) */p=\1 s=\2/'`
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin -*[0123456789])
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *[0123456789])
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin conf_limit="{ $conf_limit, 0 }" conf_minmax="{ $conf_minmax, 0 }"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin *) conf_flags=`echo "$conf_flags" | sed 's/^0.//'` ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin echo "{ \"$conf_name\", $conf_limit, $conf_minmax, $conf_flags, $conf_standard, $conf_section, $conf_call, $conf_op },"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# conf string table
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin1) echo "$command: generate ${base}.h string table header" >&2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinksh) ((name_max=name_max+3)); ((name_max=name_max/4*4)) ;; # bsd /bin/sh !
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef _CONFTAB_H
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define _CONFTAB_H
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#if !defined(const) && !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define const
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define conf _ast_conf_data
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define conf_elements _ast_conf_ndata
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define prefix _ast_conf_prefix
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define prefix_elements _ast_conf_nprefix
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_nop 0
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_confstr 1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_pathconf 2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_sysconf 3
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_sysinfo 4
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ?*) echo "#define _pth_getconf_a \"$CONF_getconf_a\"" ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_DEFER_CALL 0x0001
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_DEFER_MM 0x0002
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_FEATURE 0x0004
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_LIMIT 0x0008
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_LIMIT_DEF 0x0010
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_MINMAX 0x0020
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_MINMAX_DEF 0x0040
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_NOSECTION 0x0080
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_NOUNDERSCORE 0x0100
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_PREFIX_ONLY 0x0200
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_PREFIXED 0x0400
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_STANDARD 0x0800
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_STRING 0x1000
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_UNDERSCORE 0x2000
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONF_USER 0x4000
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char* string;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char name[${name_max}];
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin unsigned int flags;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char name[16];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin*) cmp -s $tmp.2 ${base}.h 2>/dev/null || mv $tmp.2 ${base}.h ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin1) echo "$command: generate ${base}.c string table" >&2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <unistd.h>$systeminfo$headers
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include "${base}.h"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * prefix strings -- the first few are indexed by Conf_t.standard
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *) len=`echo ${standard} | wc -c`; len=`expr $len - 1` ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinint prefix_elements = (int)sizeof(prefix) / (int)sizeof(prefix[0]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinint conf_elements = (int)sizeof(conf) / (int)sizeof(conf[0]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin*) cmp -s $tmp.4 ${base}.c 2>/dev/null || mv $tmp.4 ${base}.c ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# limits.h generation code
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin1) echo "$command: generate ${base}.h supplemental <limits.h> values" >&2 ;;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintest -f $tmp.l && cat $tmp.l