… | |
… | |
19 | |
19 | |
20 | our $VERSION = '0.913'; |
20 | our $VERSION = '0.913'; |
21 | |
21 | |
22 | use Deliantra; |
22 | use Deliantra; |
23 | use Deliantra::Map; |
23 | use Deliantra::Map; |
24 | use DB_File; |
24 | use SDBM_File; |
25 | |
25 | |
26 | sub escape_html($) { |
26 | sub escape_html($) { |
27 | local $_ = shift; |
27 | local $_ = shift; |
28 | s/([<>&])/sprintf "&#%d;", ord $1/ge; |
28 | s/([<>&])/sprintf "&#%d;", ord $1/ge; |
29 | $_ |
29 | $_ |
30 | } |
30 | } |
31 | |
31 | |
32 | sub search { |
32 | sub search { |
33 | my (@kw) = @_; |
33 | my (@kw) = @_; |
34 | |
34 | |
35 | tie %idx, DB_File, ".index.dat", O_RDONLY, 0, $DB_HASH |
35 | tie %idx, SDBM_File, ".index.dat", O_RDONLY, 0, $DB_HASH |
36 | or die ".index.dat: $!"; |
36 | or die ".index.dat: $!"; |
37 | |
37 | |
38 | my $cnt; |
38 | my $cnt; |
39 | my %res; |
39 | my %res; |
40 | my @found; |
40 | my @found; |
… | |
… | |
83 | } |
83 | } |
84 | |
84 | |
85 | if ($ARGV[0] eq "-a") { |
85 | if ($ARGV[0] eq "-a") { |
86 | shift; |
86 | shift; |
87 | |
87 | |
88 | tie %idx, DB_File, ".index.dat~", O_RDWR|O_CREAT, 0644, $DB_HASH |
88 | tie %idx, SDBM_File, ".index.dat~", O_RDWR|O_CREAT, 0644, $DB_HASH |
89 | or die ".index.dat~: $!"; |
89 | or die ".index.dat~: $!"; |
90 | |
90 | |
91 | my %idx2; |
91 | my %idx2; |
92 | |
92 | |
93 | for my $path (@ARGV) { |
93 | for my $path (@ARGV) { |