#!/usr/local/bin/perl # manpage.cgi by David Efflandt tech-ph@de-srv.com # last updated 3/11/00 # # View man pages from web browser. # Required module use CGI qw/:standard :netscape/; # Page header and input field $file = param('man').' ' if param('man'); if ($file =~ s/[\/\\\|\&\*\?;()<>`]//g) { $title = "Invalid manpage: $file"; $file = ''; } elsif ($file) { $title = "$file man page"; } else { $title = "Man Pages"; } print header, start_html($title),"\n", center(h1($title)),start_form,center('man ',textfield('man'),' '. submit(undef,' Read ')),end_form; if ($file) { $out = `man $file 2>&1`; $out =~ s//$gt;/g; $out =~ s/.\cH//g; # filter bs enhanced manpages print hr,pre($out); if (length($out) > 255) { print hr,start_form,center('man ',textfield('man'),' ', submit(undef,' Read ')),end_form; } } else { print hr,'To read man pages about a shell command, enter the ', 'command in the input field. For example if you enter ',b('perl'), " you can read 'man perl'.",p,'Some switches are useful:', '-f followed by a word will give a brief description,', '-k followed by a word will find man pages that contain the ', 'word, and a number before the word will look through that specific ', 'man section for the word.',p,'Examples:',p,b('-k perl'), ' - will list perl related man pages.',p,b('3 stat'), ' - will display stat (3) instead of stat (1).'; } print end_html;