> Ludovic Courtès ([EMAIL PROTECTED]) and I are currently trying to
> package « Reta Vortaro », an Esperanto dictionary
[snip]
> a single .dict.dz file ... has several .index files
Great! I think that we can handle it all by modifying dictdconfig a bit.
dictdconfig is driven by index files -- given <name>.index, it
currently looks for a database called <name>.dict.dz or <name>.dict.
I propose that given an index file <name>.<ext>.index, and failing to
find a database called <name>.<ext>.dict.dz or <name>.<ext>.dict, it
looks for <name>.dict.dz or <name>.dict. Finding one of the latter
databases, it adds a "name @00-database-short-<ext>" directive. So,
given the files:
revo.cs.index
revo.de.index
revo.dict.dz
it will generate the following database specifications:
database revo.cs {
data /usr/share/dictd/revo.dict.dz
index /usr/share/dictd/revo.cs.index
name @00-database-short-cs
}
database revo.de {
data /usr/share/dictd/revo.dict.dz
index /usr/share/dictd/revo.de.index
name @00-database-short-de
}
You will need to add the desired database names to the database as
definitions for 00-database-short-cs and 00-database-short-de.
Does that work for you?
Here is a diff of an experimental version of dictdconfig that
implements the above behavior. If this satisfies your needs I will
include something like it in a new unstable release. How soon do you
hope to upload?
Kirk
$ md5sum dictdconfig
9a26ea71b7fc9b92be8f927a8dfd5a45 dictdconfig
$ diff -u dictdconfig_1.9.15-1 dictdconfig
------------------------------ 8< ------------------------------
--- dictdconfig_1.9.15-1 2005-09-06 22:35:44.000000000 -0400
+++ dictdconfig 2005-09-07 00:21:03.000000000 -0400
@@ -166,12 +166,13 @@
exit 0;
sub AddEntry {
- my ( $name, $datafile, $indexfile, $suffixfile, $wordfile ) = @_;
+ my ( $name, $datafile, $indexfile, $suffixfile, $wordfile, $short ) = @_;
$output .= "database $name {\n" .
" data $datafile\n" .
" index $indexfile\n" .
( $suffixfile ? " index_suffix $suffixfile\n" : "" ) .
( $wordfile ? " index_word $wordfile\n" : "" ) .
+ ( $short ? " name $short\n" : "" ) .
"}\n";
++$db_entered{ $name };
}
@@ -179,6 +180,7 @@
sub AliasName {
my ( $name ) = @_;
if ( -x $alias_script ) { $name = `echo $name | $alias_script` }
+ chomp $name;
return $name;
}
@@ -189,19 +191,26 @@
my $indexfile;
my $suffixfile;
my $wordfile;
+ my $short;
if ( $base_name =~ m#.*/(.*)# ) { $name = $1 }
else { $name = $base_name }
- $name = AliasName( $name );
$base_name = "$db_dir/$base_name" unless $base_name =~ m#^/#;
$datafile = "$base_name.dict.dz";
$datafile =~ s/\.dz$// unless -f $datafile;
+ if (! -f $datafile && $name =~ /^.+\.(\w+)$/) {
+ $short = '@00-database-short-' . $1;
+ $datafile =~ s/\.\w+\.dict$/.dict.dz/;
+ $datafile =~ s/\.dz$// unless -f $datafile;
+ }
$indexfile = "$base_name.index";
$suffixfile = "$base_name.suffix";
$wordfile = "$base_name.word";
+ $name = AliasName( $name );
if ( ! $db_entered{ $name } && -f $datafile && -f $indexfile ) {
undef $suffixfile unless -f $suffixfile;
undef $wordfile unless -f $wordfile;
- AddEntry( $name, $datafile, $indexfile, $suffixfile, $wordfile );
+ AddEntry( $name, $datafile, $indexfile,
+ $suffixfile, $wordfile, $short );
}
}
------------------------------ >8 ------------------------------