From f85fa4374b6a253d83df4d291912110b93916c26 Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 14 Jun 2004 04:40:11 +0000 Subject: [PATCH] New file. --- m17n-db.in | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 m17n-db.in diff --git a/m17n-db.in b/m17n-db.in new file mode 100644 index 0000000..76eaf0f --- /dev/null +++ b/m17n-db.in @@ -0,0 +1,108 @@ +#!/bin/sh +# m17n-db -- print information about the m17n database. +# Copyright (C) 2004 +# National Institute of Advanced Industrial Science and Technology (AIST) +# Registration Number H15PRO112 +# See the end for copying conditions. + +prefix=@prefix@ +datadir=@datadir@ + +help () +{ + echo "Usage: $0 [ OPTIONS ] [ TAG0 [ TAG1 [ TAG2 [ TAG3 ] ] ] ]" + echo "Options:" + echo " -h, --help Print this information." + echo " -v, --version Print the version number." + echo " -l, --locate Print absolute pathnames of database files." + echo " TAG0 through TAG3 specifies the tags of the database." + echo "With no options, print the installed directory name." +} + +if test $# -gt 0; then + case "$1" in + -h | --help) help; exit 0;; + -v | --version) echo "@VERSION@"; exit 0;; + -l | --locate) DIRFILE="$datadir/m17n/mdb.dir"; shift;; + *) help; exit 1;; + esac +fi + +if test -z "$DIRFILE" ; then + echo $datadir + exit 0 +fi + +if test ! -f "$DIRFILE"; then + echo "Can't find the m17n database directory file \"$DIRFILE\"!" + exit 1 +fi + +if test -z "$1"; then + help + exit 1 +fi + +TAG="($1" +if [ -n "$2" ] ; then + TAG="${TAG}[ ][ ]*$2" +fi +if [ -n "$3" ] ; then + TAG="${TAG}[ ][ ]*$3" +fi +if [ -n "$4" ] ; then + TAG="${TAG}[ ][ ]*$4" +fi + +sed -n "/${TAG}/ s,[^\"]*\"\([^\"]*\)\".*$,\1,p" < $DIRFILE |\ + sed -e "/^[^/]/ s,\(.*\),$datadir/\1," + +exit 0 + +cat > /dev/null <