1 |
#!perl -w |
#!/usr/bin/perl -w |
2 |
# -*- Mode: Perl -*- |
# -*- Mode: Perl -*- |
3 |
# $Basename: sman $ |
# $Basename: sman $ |
4 |
# $Revision: 1.14 $ |
# $Revision: 1.14 $ |
18 |
use Fcntl qw(O_RDONLY); |
use Fcntl qw(O_RDONLY); |
19 |
use Config; |
use Config; |
20 |
|
|
21 |
use '/data/wait/lib'; |
use lib '/data/wait/lib'; |
22 |
|
|
23 |
require WAIT::Config; |
require WAIT::Config; |
24 |
require WAIT::Database; |
require WAIT::Database; |
72 |
$format = new WAIT::Format::Term; |
$format = new WAIT::Format::Term; |
73 |
} |
} |
74 |
|
|
75 |
my $pager = ($OPT{pager}) ? \&pager : \&less; |
my $pager = ($OPT{pager}) ? \&less : \&pager; |
76 |
my $OUT = $term->OUT; |
my $OUT = $term->OUT; |
77 |
|
|
78 |
my $st = 1; |
my $st = 1; |
82 |
# them (a query), show metadata for a hit (a view), show a hot (display) |
# them (a query), show metadata for a hit (a view), show a hot (display) |
83 |
|
|
84 |
my($query, @did); |
my($query, @did); |
85 |
|
my (%hits, $query_text); |
86 |
|
|
87 |
while (defined ($_ = &myreadline("$st> "))) { |
while (defined ($_ = &myreadline("$st> "))) { |
88 |
chomp; $st++; |
chomp; $st++; |
89 |
|
|
|
my(%hits, $query_text); |
|
90 |
if (/^$/) { |
if (/^$/) { |
91 |
next; |
next; |
92 |
} elsif (/^m (\d+)$/) { |
} elsif (/^m (\d+)$/) { |
192 |
q Exit from $0 |
q Exit from $0 |
193 |
l redisplay last ranking |
l redisplay last ranking |
194 |
Other input is tried as wais query. |
Other input is tried as wais query. |
195 |
The following fields are known: $idb |
The following fields for table '$OPT{table}' are known: $idb |
196 |
] ; |
] ; |
197 |
} |
} |
198 |
|
|
238 |
if ($tdid !~ m(^/)) { |
if ($tdid !~ m(^/)) { |
239 |
$tdid = $tb->dir . '/' . $tdid; |
$tdid = $tb->dir . '/' . $tdid; |
240 |
} |
} |
241 |
|
# if original version doesn't exist maybe someone created gziped one? |
242 |
|
# (this is used if you decided to compress data files after indexing, |
243 |
|
# next indexing will pick names with gz extension anyway) |
244 |
|
if (! -e $tdid && -e $tdid.".gz") { |
245 |
|
$tdid .= ".gz"; |
246 |
|
} |
247 |
|
|
248 |
# The main task of all that follows from here is highlighting. WAIT |
# The main task of all that follows from here is highlighting. WAIT |
249 |
# is designed to make it possible to show the user why a certain |
# is designed to make it possible to show the user why a certain |
363 |
} |
} |
364 |
|
|
365 |
sub less { |
sub less { |
366 |
my $flags; |
my $flags = ''; |
367 |
if ($WAIT::Config->{pager} =~ /less/) { |
my $pager = $OPT{pager}; |
368 |
|
if ($pager =~ /less/) { |
369 |
$flags = '-r'; |
$flags = '-r'; |
370 |
} elsif ($WAIT::Config->{pager} =~ /more/) { |
} elsif ($pager =~ /more/) { |
371 |
$flags = '-c'; |
$flags = '-c'; |
372 |
|
} elsif ($pager =~ /lynx/) { |
373 |
|
$flags = '-stdin'; |
374 |
} |
} |
375 |
open(PAGER, "|$WAIT::Config->{pager} $flags") or die; |
open(PAGER, "| $pager $flags") or die; |
376 |
print PAGER @_; |
print PAGER @_; |
377 |
close PAGER; |
close PAGER; |
378 |
} |
} |