3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: Thu Feb 14 14:30:06 2008
6 ###APPDESC: List and view documents of specified package
7 ###APPUSAGE: (package name)
8 ###APPEXAMPLE: doc-view aptitude
11 use lib
$ENV{XR_PERL_MODULE_DIR
};
12 use MyPlace
::Script
::Usage qw
/help_even_empty/;
13 exit 0 if(help_even_empty
($0,@ARGV));
15 my @topdir = ( "/usr/share/doc" , "/usr/local/share/doc" );
16 my $dirname = $ARGV[0];
21 print("Lookup document directory in \"",join("\", \"",@topdir),"\"\n");
23 if(-d
"$_/$dirname") {
24 $docdir = "$_/$dirname";
25 print("Found $docdir \n");
28 die("No document directory for $dirname found\n") unless($docdir);
30 chdir($docdir) or die("$!\n");
41 print("Documents list:\n");
42 print("------------------------------------------\n");
45 printf("%4s. %s\n",$idx,$_);
47 print("__________________________________________\n");
48 print("Your Choice(q to quit):")
56 if($lines eq "q" || $lines eq "Q") {
67 print STDERR
"File not exist:$file\n";
70 if($file =~ m/\.gz$/i) {
71 system($zview,"$file");
74 system($view,"$file");
79 while(my $choice = getInput
()) {
80 if($choice>0 and $choice<=@docs) {
81 viewdoc
($docdir . "/" . $docs[$choice-1]);