From: Koichi KAMICHI Date: Fri, 14 Jan 2005 05:38:41 +0000 (+0000) Subject: Add a script for alisadb. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4241cbec3c0fec927a617cfc66968ada55b25763;p=chise%2Fkage.git Add a script for alisadb. --- diff --git a/kagedb/getaliastxt.pl b/kagedb/getaliastxt.pl new file mode 100755 index 0000000..1248410 --- /dev/null +++ b/kagedb/getaliastxt.pl @@ -0,0 +1,26 @@ +############################################################################### +# getaliastxt.pl +# +# create txt file from KAGE/cgi +# by Koichi Kamichi +############################################################################### + +if($#ARGV != 0 || !(-d $ARGV[0])){ + print "Usage: perl getaliastxt.pl aliasdb_dir\n"; + exit; +} +$aliasdir = $ARGV[0]; +$aliasdir =~ s/\/?$//; # remove the last slash + +use Fcntl; +use BerkeleyDB; + +tie %db, "BerkeleyDB::Hash", -Filename => "$aliasdir/aliasdb", -Flags => DB_RDONLY +or die "An error occured at opening DB file.\n"; +%db = (); + +foreach(sort(keys(%db))){ + print "$_\t$db{$_}\n"; +} + +untie(%db);