#!/bin/sh # Man-cgi : a Common Gateway Interface which converts the output of # the "man" command to HTML # VERSION="1.15" # # Author : Panagiotis J. Christias # # Usage : it goes in the /cgi-bin/ directory. When called without # arguments (http://www-server/cgi-bin/man-cgi) it outputs a # "Front Page" with a section list and query form. When called # with arguments, the first argument is the topic (e.g. ls) # and the second argument (optional) is the section to look in. # # Examples: # http://www.ntua.gr/cgi-bin/man-cgi?ls # http://www.ntua.gr/cgi-bin/man-cgi?sleep+3 # # Notice : Man-cgi uses the following two images, you may want to get them # and put them in your w3 server: # http://www.ntua.gr/images/doty.gif # http://www.ntua.gr/images/pages.gif # # History : # 1.15 Multiple blank lines are supressed. # 1.14 Man-cgi now recognizes cross-references that # contain periods (e.g. foo.foo(3)). # 1.13 Really fixed problems occuring in pages which used # multi-overstrike for emboldening (hopefully). # 1.12 Fixed problems occuring in pages which used multi-overstrike # for emboldening. Now Man-cgi works any number of overstrike. # 1.11 Fixed problem with hyphenated cross-references. # 1.10 and earlier, no history at that time... # # Last update: Fri May 5 1995 # ### CONFIGURATION SECTION : change the following variables to fit your needs ### # The HTTPD server may not pass the enviroment variables to the script. # You should add your system path here : PATH=/usr/gnu/bin:/bin:/usr/ucb:/usr/bin:/usr/local/bin:/usr/misc/bin export PATH # The same for the man path here : MANPATH=/usr/local/man:/usr/local/share/man:/usr/X11R6/man:/usr/man:/usr/share/man:/usr/man/preformat:/usr/X11/man:/usr/openwin/man:/opt/intel/compiler70/man:/usr/netm/man export MANPATH # The full URL of the Man-cgi : MANCGI='http://www.astro.rug.nl/cgi-bin/man-cgi' # The URL of the two images : DOT=http://www.ntua.gr/images/doty.gif PAGES=http://www.ntua.gr/images/pages.gif ### END OF CONFIGURATION SECTION ############################################### SECTION=$2 COMMAND=$1 echo "Content-type: text/html" echo "" if [ $# -eq 2 ] ; then if [ $2 = "00" ] ; then read a COMMAND=`echo $a | sed 's/command=\(.*\)&.*/\1/'` SECTION=`echo $a | sed 's/command=.*§ion=\(.*\) /\1/'` if [ $SECTION = "ANY" ] ; then SECTION="" fi; fi; fi if [ $# -ne 0 ] ; then cat <UNIX man pages : $COMMAND ($SECTION)

NOTE: click here if you get an empty page.


END man $SECTION $COMMAND | \ sed \ -e '/-$/N { s/\([0-9A-z][-,0-9A-z]*\)-\n\( *\)\([0-9A-z][-,0-9A-z]*([1-9][A-z]*)\)/\1\3\ \2/ }' \ -e '/-$/N { s/\([0-9A-z][-,0-9A-z]*\)-\n\( *\)\([0-9A-z][-,0-9A-z]*([1-9][A-z]*)\)/\1\3\ \2/ }' \ -e '/-$/N { s/\([0-9A-z][-,0-9A-z]*\)-\n\( *\)\([0-9A-z][-,0-9A-z]*([1-9][A-z]*)\)/\1\3\ \2/ }' \ -e '/-$/N { s/\([0-9A-z][-,0-9A-z]*\)-\n\( *\)\([0-9A-z][-,0-9A-z]*([1-9][A-z]*)\)/\1\3\ \2/ }' \ -e 's//»/g' \ \ -e '/^[A-Z]/s/.//g' \ -e 's/^[A-Z][ ,A-Z]*$/

&<\/H2>/' \ \ -e 's/_\(.\)/\1<\/i>/g' \ -e 's/.\(.\)/\1<\/b>/g' \ \ -e 's#.##g' \ -e 's#.##g' \ -e 's#.##g' \ -e 's#_<i>##g' \ \ -e 's/<\/i>//g' \ -e 's/<\/b>//g' \ \ -e 's/^ \([A-Z][ ,0-9A-z]*\)$/ \1<\/b>/' \ -e 's/^ \([A-Z][ ,0-9A-z]*\)$/ \1<\/b>/' \ \ -e "/^ /s#\(\([0-9A-z][-.,0-9A-z]*\)(\([1-9]\)[A-z]*)\)#\1#g" \ -e "/^ /s#\(\([0-9A-z][-.,0-9A-z]*\)(\([1-9]\)[A-z]*)\)#\1#g" \ \ -e "s#+<\/b>##" \ \ -e 's/«/\</g' \ -e 's/»/\>/g' \ \ -e '1s/^/
/' \
          -e '$s/$/
<\/PRE>
/' | \
awk '/^$/     { if(!blank) { print; blank=1 } }
     /^..*$/  { print; blank=0 }'

else
  cat <
  UNIX man pages
  
  
  

UNIX ON-LINE Man Pages


These are the UNIX man pages. The html versions are created on the fly by a simple shell/sed/awk script.

NOTICE: There are still problems with the man pages that are not stored in the right section. In this case you'll get an empty page. Follow the link at the top of the empty page and you'll get your man page (hopefully).
Here are the intro pages of each section:

  1. USER COMMANDS
  2. SYSTEM CALLS
  3. C LIBRARY FUNCTIONS
  4. DEVICES AND NETWORK INTERFACES
  5. FILE FORMATS
  6. GAMES AND DEMOS
  7. ENVIRONMENTS, TABLES, AND TROFF MACROS
  8. MAINTENANCE COMMANDS
  9. X WINDOW SYSTEM


You can also request a man page by name and (optionally) by section:

Set command name :

Set Section number :

END fi cat <
© 1994 Man-cgi $VERSION, Panagiotis Christias <christia@theseas.ntua.gr>
END