99#
1010#
1111# IDENTIFICATION
12- # $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh.in ,v 1.25 2000/06/07 16:26:48 petere Exp $
12+ # $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.15 2000/07/01 21: 16:44 petere Exp $
1313#
1414# -------------------------------------------------------------------------
1515
1616CMDNAME=` basename$0 `
1717
18- AWK=" @AWK@ "
19- CPP=" @CPP@ "
18+ : ${ AWK=' awk ' }
19+ : ${ CPP=' cc -E ' }
2020
2121cleanup (){
22- [ x" $noclean " != x" t" ]&& rm -f" $CPPTMPFILE " " $RAWFILE " " $OIDSFILE .tmp " " $TABLEFILE .tmp "
22+ [ x" $noclean " != x" t" ]&& rm -f" $CPPTMPFILE " " $RAWFILE "
2323}
2424
2525BKIOPTS=
4646echo " Usage:"
4747echo " $CMDNAME [ -D define [...] ]"
4848echo
49+ echo " The environment variables CPP and AWK determine which C"
50+ echo " preprocessor and Awk program to use. The defaults are"
51+ echo " \` cc -E' and\` awk'."
52+ echo
4953echo " Report bugs to <pgsql-bugs@postgresql.org>."
5054exit 0
5155 ;;
@@ -119,7 +123,7 @@ cpp_define=`echo $OIDSFILE | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTU
119123#
120124# Generate fmgroids.h
121125#
122- cat> " ${ OIDSFILE} .tmp " << FuNkYfMgRsTuFf
126+ cat> " $OIDSFILE " << FuNkYfMgRsTuFf
123127/*-------------------------------------------------------------------------
124128 *
125129 *$OIDSFILE
@@ -160,15 +164,15 @@ FuNkYfMgRsTuFf
160164tr' abcdefghijklmnopqrstuvwxyz' ' ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \
161165$AWK '
162166BEGIN{ OFS = ""; }
163- { if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }' >> " ${ OIDSFILE} .tmp "
167+ { if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }' >> " $OIDSFILE "
164168
165169if [$? -ne 0 ]; then
166170 cleanup
167171echo " $CMDNAME failed"
168172exit 1
169173fi
170174
171- cat>> " ${ OIDSFILE} .tmp " << FuNkYfMgRsTuFf
175+ cat>> " $OIDSFILE " << FuNkYfMgRsTuFf
172176
173177#endif/*$cpp_define */
174178FuNkYfMgRsTuFf
@@ -182,7 +186,7 @@ FuNkYfMgRsTuFf
182186# this table definition as a separate C file that won't need to include any
183187# "real" declarations for those functions!
184188#
185- cat> " ${ TABLEFILE} .tmp " << FuNkYfMgRtAbStUfF
189+ cat> " $TABLEFILE " << FuNkYfMgRtAbStUfF
186190/*-------------------------------------------------------------------------
187191 *
188192 *$TABLEFILE
@@ -213,7 +217,7 @@ cat > "${TABLEFILE}.tmp" <<FuNkYfMgRtAbStUfF
213217
214218FuNkYfMgRtAbStUfF
215219
216- $AWK ' { print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> " ${ TABLEFILE} .tmp "
220+ $AWK ' { print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> " $TABLEFILE "
217221
218222if [$? -ne 0 ]; then
219223 cleanup
@@ -222,7 +226,7 @@ if [ $? -ne 0 ]; then
222226fi
223227
224228
225- cat>> " ${ TABLEFILE} .tmp " << FuNkYfMgRtAbStUfF
229+ cat>> " $TABLEFILE " << FuNkYfMgRtAbStUfF
226230
227231const FmgrBuiltin fmgr_builtins[] = {
228232FuNkYfMgRtAbStUfF
@@ -239,15 +243,15 @@ $AWK 'BEGIN {
239243}
240244{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
241245$1, $(NF-1), $9, Strict[$8], OldStyle[$4], $(NF-1)
242- }' $RAWFILE >> " ${ TABLEFILE} .tmp "
246+ }' $RAWFILE >> " $TABLEFILE "
243247
244248if [$? -ne 0 ]; then
245249 cleanup
246250echo " $CMDNAME failed"
247251exit 1
248252fi
249253
250- cat>> " ${ TABLEFILE} .tmp " << FuNkYfMgRtAbStUfF
254+ cat>> " $TABLEFILE " << FuNkYfMgRtAbStUfF
251255 /* dummy entry is easier than getting rid of comma after last real one */
252256 /* (not that there has ever been anything wrong with *having* a
253257 comma after the last field in an array initializer) */
@@ -259,22 +263,5 @@ const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1;
259263
260264FuNkYfMgRtAbStUfF
261265
262-
263-
264- # Now we check if the files fmgroids.h and fmgrtab.c already exist and
265- # are identical to what we would make them. In that case we avoid
266- # writing our new version, so as to not cause unnecessary recompilation
267- # because of changed timestamps.
268-
269- for file in " $OIDSFILE " " $TABLEFILE " ; do
270- if test -f" $file " && cmp -s" $file " " ${file} .tmp" ; then
271- echo " $file unchanged"
272- rm -f" ${file} .tmp"
273- else
274- mv" ${file} .tmp" " $file "
275- fi
276- done
277-
278-
279266cleanup
280267exit 0