Listing 2. sman is a command-line utility to search man pages. #!/usr/bin/perl -w use strict; use Getopt::Long qw(GetOptions); use SWISH::API; my ($max,$rankshow,$fileshow,$cnt) = (20,0,0,0); my $index = "./sman.index"; GetOptions( "max=i" => \$max, "index=s" => \$index, "rank" => \$rankshow, "file" => \$fileshow, ); my $query = join(" ", @ARGV); my $handle = SWISH::API->new($index); my $results = $handle->Query( $query ); if ( $results->Hits() <= 0 ) { warn "No Results for '$query'.\n"; } if ( my $error = $handle->Error( ) ) { warn "Error: ", $handle->ErrorString(), "\n"; } while ( ($cnt++ < $max) && (my $res = $results->NextResult)) { printf "%4d ", $res->Property( "swishrank" ) if $rankshow; my $title = $res->Property( "swishtitle" ); if (my $cmd = $res->Property( "cmd" )) { $title .= " [$cmd]"; } printf "%-25s (%s) %-30s", $title, $res->Property( "sec" ), $res->Property( "desc" ); printf " %s", $res->Property( "swishdocpath" ) if $fileshow; print "\n"; }