--- util/tsipackdb.in.orig	2004-09-28 14:59:14 UTC
+++ util/tsipackdb.in
@@ -26,13 +26,25 @@ mywhich () {
 }
 
 pack_db_file () {
-    db_dump=`mywhich ${1}_dump`
-    db_load=`mywhich ${1}_load`
+    case "${1}" in
+    db|db3|db4|db41) 
+        db_dump=`mywhich ${1}_dump`
+        db_load=`mywhich ${1}_load`
+        ;;
+    db-4.[234])
+        db_name=${1#db-}
+        db_dump=`mywhich db_dump-${db_name}`
+        db_load=`mywhich db_load-${db_name}`
+        ;;
+    *)
+        echo "unsupported Berkeley version: ${1}"
+        return 1
+    esac
     if [ -x "$db_dump" ] && [ -x "$db_load" ]; then
 	echo "Try using $db_dump and $db_load to pack $2 ...."
 
-	${1}_dump $2 > $2.tmp && \
-	${1}_load $2.new < $2.tmp && \
+ 	$db_dump $2 > $2.tmp && \
+ 	$db_load $2.new < $2.tmp && \
 	mv $2.new $2 && \
 	rm -f $2.tmp && \
 	return 0
@@ -41,9 +53,9 @@ pack_db_file () {
     return 1
 }
 
-for dbprefix in db db2 db3 db4
+for dbname in @with_db_name@ db db2 db3 db4
 do
-    pack_db_file $dbprefix $1 && exit 0
+    pack_db_file $dbname $1 && exit 0
 done
 
 exit 0
