*** empty log message ***
[m17n/m17n-db.git] / m17n-db.in
1 #!/bin/sh
2 # m17n-db -- print information about the m17n database.
3 # Copyright (C) 2004
4 #   National Institute of Advanced Industrial Science and Technology (AIST)
5 #   Registration Number H15PRO112
6 # See the end for copying conditions.
7
8 prefix=@prefix@
9 datadir=@datadir@
10
11 help ()
12 {
13   echo "Usage: $0 [ OPTIONS ] [ TAG0 [ TAG1 [ TAG2 [ TAG3 ] ] ] ]"
14   echo "Options:"
15   echo "  -h, --help    Print this information."
16   echo "  -v, --version Print the version number."
17   echo "  -l, --locate  Print absolute pathnames of database files."
18   echo "        TAG0 through TAG3 specifies the tags of the database."
19   echo "With no options, print the installed directory name."
20 }
21
22 if test $# -gt 0; then
23   case "$1" in
24     -h | --help) help; exit 0;;
25     -v | --version) echo "@VERSION@"; exit 0;;
26     -l | --locate) DIRFILE="$datadir/m17n/mdb.dir"; shift;;
27     *) help; exit 1;;
28   esac
29 fi
30
31 if test -z "$DIRFILE" ; then
32   echo $datadir/m17n
33   exit 0
34 fi
35
36 if test ! -f "$DIRFILE"; then
37   echo "Can't find the m17n database directory file \"$DIRFILE\"!"
38   exit 1
39 fi
40
41 if test -z "$1"; then
42   help
43   exit 1
44 fi
45
46 TAG="($1"
47 if [ -n "$2" ] ; then
48   TAG="${TAG}[  ][      ]*$2"
49 fi
50 if [ -n "$3" ] ; then
51   TAG="${TAG}[  ][      ]*$3"
52 fi
53 if [ -n "$4" ] ; then
54   TAG="${TAG}[  ][      ]*$4"
55 fi
56
57 sed -n "/${TAG}/ s,[^\"]*\"\([^\"]*\)\".*$,\1,p" < $DIRFILE |\
58   sed -e "/^[^/]/ s,\(.*\),$datadir/\1,"
59
60 exit 0
61
62 cat > /dev/null <<EOF
63 /***en @page m17n-db Print information about the m17n database */
64 /***ja @page m17n-config m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¾ðÊó¤òɽ¼¨ */
65
66 /***
67 @section synopsis SYNOPSIS
68
69 m17n-db  [ OPTIONS ] [ TAG0 [ TAG1 [ TAG2 [ TAG3 ] ] ] ]
70
71 @section description DESCRIPTION
72
73 The shell script m17n-db prints information about the m17n database.
74
75 The arguments OPTIONS has the following meanings.
76
77 - -h, --help\n
78         Print this information."
79 - -v, --version\n
80         Print the version number."
81 - -l, --locate\n
82         Print absolute pathnames of database files.\n
83         TAG0 through TAG3 specifies the tags of the database."
84
85 With no arguments, print where the m17n database is installed.  */ 
86 EOF
87
88 # Copyright (C) 2004
89 #   National Institute of Advanced Industrial Science and Technology (AIST)
90 #   Registration Number H15PRO112
91
92 # This file is part of the m17n database; a sub-part of the m17n
93 # library.
94
95 # The m17n library is free software; you can redistribute it and/or
96 # modify it under the terms of the GNU Lesser General Public License
97 # as published by the Free Software Foundation; either version 2.1 of
98 # the License, or (at your option) any later version.
99
100 # The m17n library is distributed in the hope that it will be useful,
101 # but WITHOUT ANY WARRANTY; without even the implied warranty of
102 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
103 # Lesser General Public License for more details.
104
105 # You should have received a copy of the GNU Lesser General Public
106 # License along with the m17n library; if not, write to the Free
107 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
108 # 02111-1307, USA.