[NTLUG:Discuss] Viewing documentation in /usr/share/doc

rob apodaca rob.apodaca at attbi.com
Fri Dec 6 13:27:48 CST 2002


On Fri, 6 Dec 2002 08:57:32 -0600
"Rick Matthews"
<RedHat.Linux at verizon.net> wrote:

> There is a tremendous amount of
> documentation in /usr/share/doc (at
> least there is on my Red Hat
> system), but I find that I seldom
> use it because it is cumbersome for
> me to use remotely.
> 
> Apache is running on that box; how
> can I get apache to serve up the
> html docs in that tree?
> 
> Is there a better way?
> 
> Thanks,
> Rick 

I am doing something similar with a
php script. Below is a stripped down
version you could use if you have php
running. Not necessarily a better
way...just a way.

cheers,
-rob

<?
if(!$dir)
$dir = "/usr/share/doc";

function my_open_dir($thisdir)
{
        if(is_dir($thisdir))
        {
                print "Contents of
$thisdir<br>";               
$DH=opendir($thisdir);               
while($file = readdir($DH))           
     {                        if($file
!= "." && $file != "..")              
         {                            
   $path = "$thisdir" . "/$file";     
                         
if(is_dir($path))                     
          {                           
            print "DIR ";             
                  }                   
             else                     
          {                           
            print "FILE ";            
                   }                  
              print "<a
href=\"$PHP_SELF?dir=$path\">$path</a
><br>"; 
                        } 
                } 
                closedir($DH); 
        } 
        else 
        { 
                $FP = fopen($thisdir,
"r");                $contents =
fread($FP, filesize($thisdir));       
        print "$contents";        }
}
my_open_dir($dir);
?>





More information about the Discuss mailing list