#!/usr/bin/perl ##---------------------------------------------------------------------------## ## File: ## mancgi.pl ## Author: ## Emanuele Lombardi lele@mantegna.casaccia.enea.it ## Description: ## mancgi is a Perl cgi wich, with man2html4cgi, ## makes a centralized multi hosts unix MAN utility ## on a single web browser ## Usage: ## http://your.web.server/cgi-bin/mancgi.pl ## ## Notes: ## the user running the web-server must have sh as login shell ## Not any other due to the redirection of std-err made as 2&1 ## ##---------------------------------------------------------------------------## ## Copyright (C) 1997 Emanuele Lombardi lele@mantegna.casaccia.enea.it ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ##---------------------------------------------------------------------------## use CGI; $query = new CGI; $man2html="./man2html4cgi"; #Path of the script which translates from man to html #man2html4cgi is a sligthtly modified version of man2html (v2.1.0) of #Earl Hood, ehood@convex.com #If not an absolute path it is relative to dir /cgi-bin $remotehosts=" "; #$remotehosts=([mantegna,cicero,seneca,cray,canaletto,'pippo-due']); #available hosts to get man from.; If it is set to null string the only #host will be the one on which the web server is running $user=" "; #$user="lele"; #username to be used for rsh on remote hosts (if any) #(must have .rhosts set for rsh command coming from the user #which belongs the web server from the machine on which it runs) ##On some machine the web server does not set the environment variable $MANPATH. ##In such cases you cannot use tha man command since it would give only the ##pages in /usr/man. If this appens you always need to rsh a user even if the ##host is the same: rsh -l $user $host man ##The selected user $user MUST set the MANPATH environment variable ##in its .cshrc (or at least in /etc/csh.cshrc). $titlecmd="command"; $titlepag="at page"; $titlehost="on host"; $manbutton="man"; $aproposbutton="apropos"; $helpbutton='?'; ##### YOU SHOULD HAVE NO NEED TO MODIFY BELOW THIS LINE ##### APART CHANGING THE LOOK OF THE MAN BROWSER $thiscgi=$query->script_name(); #name of this script as seen from the web server ($thishost)=split(/\./,$query->server_name); #name of this host (web server is running on it) if ($remotehosts == "") {$remotehosts=([$thishost])} print $query->header; print $query->start_html(-title=>"mancgi", -author=>'lele@mantegna.casaccia.enea.it'); @names=$query->keywords; $host1=@names[0]; $command1=@names[1]; $page1=@names[2]; print $query->startform; print "$titlehost: "; print $query->popup_menu(-name=>'host', -values=>$remotehosts, -default=>$host1); print "$titlecmd: "; print $query->textfield(-name=>'command', size=>10,maxlength=>25,default=>$command1); print " "; print $query->submit(-name=>'choice',-value=>$manbutton); print " "; print $query->submit(-name=>'choice',-value=>$aproposbutton); print $query->submit(-name=>'choice',-value=>$helpbutton); print " "; print "
$titlehost @_[0] | \n"; print "@_[3] @_[1] | \n"; if (@_[2] ne "") {print "$titlepag @_[2] | \n"} print "