aboutsummaryrefslogtreecommitdiff
path: root/src/backenddb/pg_template.sh
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-04-09 23:22:30 +0200
committerChristian Grothoff <christian@grothoff.org>2023-04-09 23:22:30 +0200
commit31babe5cf8e1259b719461fa318db9ae0778ec1a (patch)
treeea406fe7c1cd1d9b56b59e4b650a57a57dbb17c1 /src/backenddb/pg_template.sh
parent071fa58c863905df0d6cf3cc617ac2b000351acd (diff)
preparations for DB logic refactoring
Diffstat (limited to 'src/backenddb/pg_template.sh')
-rwxr-xr-xsrc/backenddb/pg_template.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backenddb/pg_template.sh b/src/backenddb/pg_template.sh
new file mode 100755
index 00000000..087d6ab8
--- /dev/null
+++ b/src/backenddb/pg_template.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# This file is in the public domain.
+#
+# Instantiates pg_template for a particular function.
+
+for n in $*
+do
+ NCAPS=`echo $n | tr a-z A-Z`
+ if test ! -e pg_$n.c
+ then
+ cat pg_template.c | sed -e s/template/$n/g -e s/TEMPLATE/$NCAPS/g > pg_$n.c
+ cat pg_template.h | sed -e s/template/$n/g -e s/TEMPLATE/$NCAPS/g > pg_$n.h
+ echo " plugin->$n\n = &TMH_PG_$n;" >> tmpl.c
+ echo "#include \"pg_$n.h\"" >> tmpl.inc
+ echo " pg_$n.h pg_$n.c \\" >> tmpl.am
+ fi
+done
+
+echo "Add lines from tmpl.am to Makefile.am"
+echo "Add lines from tmpl.inc to plugin_merchantdb_postgres.c at the beginning"
+echo "Add lines from tmpl.c to plugin_merchantdb_postgres.c at the end"