#!/usr/bin/perl # # Do some lookups in the TeX formatted lojban dictionary # # Seth Golub # April 1996 require "getopts.pl"; &Getopts("f:") || &Usage(); &Usage if $opt_h; &Usage if !@ARGV; $dict_file = $opt_f || "$ENV{HOME}/lib/lojban/dict.tex"; if ( (! -f $dict_file) && -f "${dict_file}.gz" ) { $dict_file .= ".gz"; } sub Usage { $0 =~ s#.*/##; print STDERR < ) { if ( /^\\.{$word *}/i ) { $match = $_; last; } } close( DICT ); exit if !$match; $match = &process($match); print "$match\n"; ($word) = $match =~ /\}\{([^ \}]+)[ \}]/; } while ($match =~ /^\\r/); exit; # Change \xa\ to x1, etc. sub process { local ($_) = @_; s/\\x([a-e])\\?/"x" . (index("abcde", $1)+1)/ge; $_; }