#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in,v 1.25 2000/06/07 16:26:48 petere Exp $
+# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.15 2000/07/01 21:16:44 petere Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
-AWK="@AWK@"
-CPP="@CPP@"
+: ${AWK='awk'}
+: ${CPP='cc -E'}
cleanup(){
- [ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE" "$OIDSFILE.tmp" "$TABLEFILE.tmp"
+ [ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE"
}
BKIOPTS=
echo "Usage:"
echo " $CMDNAME [ -D define [...] ]"
echo
+ echo "The environment variables CPP and AWK determine which C"
+ echo "preprocessor and Awk program to use. The defaults are"
+ echo "\`cc -E' and \`awk'."
+ echo
echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
;;
#
# Generate fmgroids.h
#
-cat > "${OIDSFILE}.tmp" <<FuNkYfMgRsTuFf
+cat > "$OIDSFILE" <<FuNkYfMgRsTuFf
/*-------------------------------------------------------------------------
*
* $OIDSFILE
tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \
$AWK '
BEGIN { OFS = ""; }
- { if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }' >> "${OIDSFILE}.tmp"
+ { if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }' >> "$OIDSFILE"
if [ $? -ne 0 ]; then
cleanup
exit 1
fi
-cat >> "${OIDSFILE}.tmp" <<FuNkYfMgRsTuFf
+cat >> "$OIDSFILE" <<FuNkYfMgRsTuFf
#endif /* $cpp_define */
FuNkYfMgRsTuFf
# this table definition as a separate C file that won't need to include any
# "real" declarations for those functions!
#
-cat > "${TABLEFILE}.tmp" <<FuNkYfMgRtAbStUfF
+cat > "$TABLEFILE" <<FuNkYfMgRtAbStUfF
/*-------------------------------------------------------------------------
*
* $TABLEFILE
FuNkYfMgRtAbStUfF
-$AWK '{ print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> "${TABLEFILE}.tmp"
+$AWK '{ print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> "$TABLEFILE"
if [ $? -ne 0 ]; then
cleanup
fi
-cat >> "${TABLEFILE}.tmp" <<FuNkYfMgRtAbStUfF
+cat >> "$TABLEFILE" <<FuNkYfMgRtAbStUfF
const FmgrBuiltin fmgr_builtins[] = {
FuNkYfMgRtAbStUfF
}
{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
$1, $(NF-1), $9, Strict[$8], OldStyle[$4], $(NF-1)
-}' $RAWFILE >> "${TABLEFILE}.tmp"
+}' $RAWFILE >> "$TABLEFILE"
if [ $? -ne 0 ]; then
cleanup
exit 1
fi
-cat >> "${TABLEFILE}.tmp" <<FuNkYfMgRtAbStUfF
+cat >> "$TABLEFILE" <<FuNkYfMgRtAbStUfF
/* dummy entry is easier than getting rid of comma after last real one */
/* (not that there has ever been anything wrong with *having* a
comma after the last field in an array initializer) */
FuNkYfMgRtAbStUfF
-
-
-# Now we check if the files fmgroids.h and fmgrtab.c already exist and
-# are identical to what we would make them. In that case we avoid
-# writing our new version, so as to not cause unnecessary recompilation
-# because of changed timestamps.
-
-for file in "$OIDSFILE" "$TABLEFILE" ; do
- if test -f "$file" && cmp -s "$file" "${file}.tmp" ; then
- echo "$file unchanged"
- rm -f "${file}.tmp"
- else
- mv "${file}.tmp" "$file"
- fi
-done
-
-
cleanup
exit 0