| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# namazu indexer perl version for hns |
| 4 |
# version 0.0.1 |
| 5 |
# 2001/3/3 Kenji Suzuki <kenji@h14m.org> |
| 6 |
|
| 7 |
# Copyright (C) 2001 Kenji Suzuki, HyperNikkiSystem Project |
| 8 |
|
| 9 |
# This program is free software; you can redistribute it and/or |
| 10 |
# modify it under the terms of the GNU General Public License |
| 11 |
# as published by the Free Software Foundation; either version 2 |
| 12 |
# of the License, or any later version. |
| 13 |
|
| 14 |
# This program is distributed in the hope that it will be useful, |
| 15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
# GNU General Public License for more details. |
| 18 |
|
| 19 |
# You should have received a copy of the GNU General Public License |
| 20 |
# along with this program; if not, write to the Free Software |
| 21 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 |
|
| 23 |
# $Id: hns-index2.in,v 1.5 2000/05/16 15:04:25 kenji Exp $ |
| 24 |
|
| 25 |
my $version="perl version 0.0.1(Namazu for hns 2.0-pl4)"; |
| 26 |
|
| 27 |
my $diaryDir="/home/kenji/diary"; |
| 28 |
my $indexDir="$diaryDir/namazu2/index"; |
| 29 |
my $tmpindexDir="$indexDir/tmp"; |
| 30 |
my $mknmz="/usr/local/namazu2/bin/mknmz"; |
| 31 |
my $gcnmz="/usr/local/namazu2/bin/gcnmz"; |
| 32 |
|
| 33 |
#my $LANG="ja"; |
| 34 |
|
| 35 |
my $arg = @ARGV[0]; |
| 36 |
|
| 37 |
if ($arg eq "-h") { |
| 38 |
print "hns-index2 $version\n"; |
| 39 |
print "$0 --- append index\n"; |
| 40 |
# print "$0 clean --- making index from scratch\n"; |
| 41 |
print "$0 -gc --- gabage collection of index file\n"; |
| 42 |
print "$0 -v --- show version\n"; |
| 43 |
print "$0 -h --- show this help\n"; |
| 44 |
exit; |
| 45 |
} |
| 46 |
if ($arg eq "-v") { |
| 47 |
print "hns-index2 $version\n"; |
| 48 |
exit; |
| 49 |
} |
| 50 |
if ($arg eq "-gc") { |
| 51 |
system ("$gcnmz $indexDir"); |
| 52 |
exit; |
| 53 |
} |
| 54 |
if ($arg eq "clean") { |
| 55 |
print "clean opion has not yet implimented.\n"; |
| 56 |
exit; |
| 57 |
|
| 58 |
mkdir "$tmpindexDir.$$", 0755; |
| 59 |
|
| 60 |
system ("$mknmz --include=$diaryDir/namazu2/etc/mknmzrc --media-type=text/hnf --template-dir=$diaryDir/namazu2/template --output-dir=$indexDir.$$ $diaryDir"); |
| 61 |
|
| 62 |
rename ("$indexDir/NMZ.slog", "$indexDir/MNZ.slog.bk"); |
| 63 |
#mv "$tmpindexDir.$$/NMZ.*" "$indexDir" |
| 64 |
rename ("$indexDir/MNZ.slog.bk", "$indexDir/NMZ.slog"); |
| 65 |
|
| 66 |
my @list = glob "$indexDir.$$/*"; |
| 67 |
unlink @list; |
| 68 |
rmdir "$indexDir.$$"; |
| 69 |
|
| 70 |
exit; |
| 71 |
} |
| 72 |
if ($arg eq "-d") { |
| 73 |
system ("$mknmz --include=$diaryDir/namazu2/etc/mknmzrc --debug --media-type=text/hnf --template-dir=$diaryDir/namazu2/template --output-dir=$indexDir $diaryDir"); |
| 74 |
exit; |
| 75 |
} |
| 76 |
else { |
| 77 |
system ("$mknmz --include=$diaryDir/namazu2/etc/mknmzrc --media-type=text/hnf --template-dir=$diaryDir/namazu2/template --output-dir=$indexDir $diaryDir"); |
| 78 |
} |
| 79 |
|
| 80 |
|