man2html-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Man2html-dev] Uncommited changes to man.cgi


From: Earl Hood
Subject: [Man2html-dev] Uncommited changes to man.cgi
Date: Thu, 22 May 2003 18:09:08 -0500

Here are the local changes made to man.cgi that were never commited.
I've made the diff against the baseline versions commited into
Savannah:

Index: man.cgi
===================================================================
RCS file: /cvsroot/man2html/man2html/man.cgi,v
retrieving revision 1.2
diff -p -u -r1.2 man.cgi
--- man.cgi     22 May 2003 22:23:31 -0000      1.2
+++ man.cgi     22 May 2003 23:06:58 -0000
@@ -35,6 +35,8 @@
 ##  02111-1307, USA
 ##---------------------------------------------------------------------------##
 
+package ManCGI;
+
 ########################################################################
 ##     Configureable Globals
 ########################################################################
@@ -42,63 +44,92 @@
 ##     system configuration.
 ########################################################################
 
-##  "English" name for program
+## "English" name for program
 
-$ProgName      = "Manpage Viewer";
+my $ProgName   = "Manpage Viewer";
 
-##  cgi-bin directory as accessed by a URL.
+##  URL of CGI program.  Change if server does not support SCRIPT_NAME
+##  envariable
 
-$CgiBin        = "/cgi-bin";
+my $CgiPrg     = $ENV{'SCRIPT_NAME'};
 
 ##  man program (should be a full pathname)
 
-$ManPrg                = '/usr/bin/man';
+my $ManPrg     = '/usr/bin/man';
 
 ##  man(1) option to specify a section.  "-s" is used for Solaris
 ##  systems.  If using Tom Christiansen's Perl man program, than
 ##  define use "".
 
-#$SectOpt      = "";
-$SectOpt       = "-s";
+#my $SectOpt   = "";
+my $SectOpt    = "-s";
 
 ##  man2html program (needs to be a full pathname)
 
-$ManConvPrg    = '/usr/local/bin/man2html';
+my $ManConvPrg = '/usr/local/bin/man2html';
 
 ##  Flag if the -cgiurl option should be used
 
-$DoCgiurl      = 1;
+my $DoCgiurl   = 1;
 
 ##  System specific arguments to man2html:
 ##     HP  => ("-leftm", "1", "-topm", "8")
 ##     Sun => ("-sun")
 ##  See man2html documentation for more information.
 
address@hidden  = ("-compress");
address@hidden  = ("-compress", "-leftm", "1", "-topm", "8");
address@hidden  = ("-compress", "-sun");
+#my @ConvArgs  = ("-compress");
+#my @ConvArgs  = ("-compress", "-leftm", "1", "-topm", "8");
+my @ConvArgs   = ("-compress", "-sun");
 
 ##  Keyword search processing arguments for man2html.  Normally,
 ##  '-k' is adequate.  However, if on a Solaris system, the
 ##  '-solaris' option should be specified with '-k'.  See
 ##  man2html documentation on information about the '-solaris' option.
 
address@hidden  = ("-k");                       # Normal
address@hidden  = ("-k", "-solaris");           # For Solaris
-
-##  Possible manual sections.  This array is used to determine the
-##  the choices available in an option menu.
+#my @KeyWArgs  = ("-k");                       # Normal
+my @KeyWArgs   = ("-k", "-solaris");           # For Solaris
 
address@hidden  = (
-    '1', '1F', '1M',
-    '2',
-    '3', '3C', '3F', '3G', '3I', '3N', '3S', '3X',
-    '4',
-    '5',
-    '6',
-    '7',
-    '8',
-    '9', '9F',
+##  Possible manual sections.  This hash is used to determine the
+##  the choices available in an option menu.  The default settings
+##  apply to Solaris/SunOS.
+
+my %Sections   = (
+# Section      Description
+#---------     ---------------------------------------------------------
+    1  =>      "User Commands",
+    1B =>      "SunOS/BSD Compatibility Package Commands",
+    1C =>      "System Communication Commands",
+    1F =>      "Form and Menu Language Interpreter (FMLI) Commands",
+    1M =>      "System Maintenance Commands",
+    1S =>      "SunOS Specific Commands",
+    2  =>      "System Calls",
+    3  =>      "C Library Functions",
+    3B =>      "BSD Compatibility Functions",
+    3C =>      "Standard C Library Functions",
+    3E =>      "ELF Access Library",
+    3G =>      "String Pattern-Matching & Pathname Library",
+    3I =>      "Multi-byte Character Library",
+    3K =>      "Kernel Virtual Memory Library",
+    3M =>      "Math Library",
+    3N =>      "Network Service Library",
+    3R =>      "POSIX.4 Realtime Library",
+    3S =>      "Standard I/O Package",
+    3T =>      "Thread Libraries",
+    3X =>      "Specialized Libraries",
+    4  =>      "File Formats",
+    5  =>      "Headers, Tables, and Macros",
+    6  =>      "Games and Demos",
+    7  =>      "Device and Network Interfaces",
+    7D =>      "Hardware Peripherals & Device Drivers",
+    7FS        =>      "Programmatic Interface to File Systems",
+    7I =>      "ioctl Requests",
+    7M =>      "STREAMS Modules",
+    7P =>      "Network Protocols",
+    8  =>      "Maintenance Procedures",
+    9  =>      "Device Driver Interfaces",
+    9E =>      "Driver Entry Point Routines",
+    9F =>      "Driver Support Routines",
+    9S =>      "Driver-related Data Structures",
 );
 
 ##  Form method.  The value is either 'GET' or 'POST'.  'GET' is
@@ -106,7 +137,7 @@ $DoCgiurl   = 1;
 ##  the argument information.  This allows a client's "Reload" function
 ##  to reprocess a currently viewed manpage.
 
-$FormMethod    = 'GET';
+my $FormMethod = 'GET';
 
 ##  Argument separator for CGI URL links.  As clients become more
 ##  SGML conformant, the simple use of '&' conflicts with
@@ -117,12 +148,12 @@ $FormMethod       = 'GET';
 ##     ;
 ##
 
-$ArgSep                = '&';
+my $ArgSep     = '&';
 
 ##  Man directories.  Add paths to the list you want man(1) to
 ##  know about
 
address@hidden  = qw(
+my @ManPath    = qw(
     /usr/local/man
     /usr/openwin/man
     /usr/man
@@ -132,7 +163,7 @@ $ArgSep             = '&';
 ##  is to have groff utils first in path since its nroff would
 ##  be invoked over the systems nroff when man formats a manpage.
 
address@hidden          = qw(
+my @Path       = qw(
     /opt/FSFgroff/bin
     /bin
     /usr/bin
@@ -146,13 +177,15 @@ $ArgSep           = '&';
 ##     Globals
 ########################################################################
 
-($PROG = $0)   =~ s/.*\///;            # Name of program
+my $PROG;
+   ($PROG = $0)        =~ s/.*\///;            # Name of program
 $VERSION       = '2.0.1';              # Version
-%FORM          = ();                   # Hash to hold form contents
-$Error         = '';                   # Error string
 $ENV{'MANPATH'}        = join(":", @ManPath);
 $ENV{'PATH'}   = join(":", @Path);
 
+my %FORM       = ();                   # Hash to hold form contents
+my $Error      = '';                   # Error string
+
 ########################################################################
 ##     Main block
 {
@@ -186,19 +219,20 @@ sub printform {
 Please fill out the following fields and select <strong>Submit</strong>
 to view a manpage.
 </p>
-<form method="$FormMethod" action="$CgiBin/man.cgi">
+<form method="$FormMethod" action="$CgiPrg">
 <table border=0>
 <tr>
 <td align=right>Section:</td>
 <td><select name=section>
 <option value="all">All Sections</option>
 <option value="keyword">Keyword Search</option>
+<option value="whatis">Whatis Search</option>
 EndOfForm
 
     #  Print out possible section choices
-    local($section);
-    foreach $section (@Sections) {
-       print STDOUT qq|<option value="$section">Section $section</option>\n|;
+    my($s);
+    foreach $s (sort keys %Sections) {
+       print STDOUT qq|<option value="$s">[$s] $Sections{$s}</option>\n|;
     }
 
 print STDOUT <<EndOfForm;
@@ -242,6 +276,13 @@ sub doit {
        push(@manargs, "-k", $topic);
        push(@ARGV, @KeyWArgs,
                    "-title", qq{Keyword search: "$topic"});
+
+    } elsif ($section =~ /whatis/) {
+       $manexec .= " -k $topic";
+       push(@manargs, "-f", $topic);
+       push(@ARGV, @KeyWArgs,
+                   "-title", qq{Whatis search: "$topic"});
+
     } else {
        error("No topic entered")  unless $topic;
        if ($section !~ /all/) {
@@ -261,7 +302,7 @@ sub doit {
     #----------------------------------
     if ($DoCgiurl) {
        push(@ARGV, "-cgiurl",
-                   join('', $CgiBin, '/man.cgi?',
+                   join('', $CgiPrg, '?',
                             'section=${section}${subsection}',
                             $ArgSep,
                             'topic=${title}'));
@@ -269,7 +310,7 @@ sub doit {
 
     # Convert output from man to html
     #--------------------------------
-    close(STDERR);
+    close(STDERR);     # Shut-up man errors
     open(MANPRG, "-|") or exec($ManPrg, @manargs);
     $Man2Html::InFH = \*MANPRG;                # set input filehandle
     require $ManConvPrg or
@@ -397,7 +438,7 @@ sub expandstr {
 #
 sub isquestionable {
     my($str) = shift;
-    $str !~ /^[a-zA-Z0-9_\-+ \t\/@%\.]+$/;
+    $str !~ /^[a-zA-Z0-9_\-+ \t\/@%\.:]+$/;
 }
 
 ########################################################################




reply via email to

[Prev in Thread] Current Thread [Next in Thread]