From f4092abdf94af6a99aff944d6264bc1284e8bdd4 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Mon, 10 Oct 2011 17:43:39 +0200 Subject: Imported nx-X11-3.1.0-1.tar.gz Summary: Imported nx-X11-3.1.0-1.tar.gz Keywords: Imported nx-X11-3.1.0-1.tar.gz into Git repository --- nx-X11/extras/rman/contrib/README-contrib | 144 +++++++++++ nx-X11/extras/rman/contrib/authried.txt | 36 +++ nx-X11/extras/rman/contrib/bennett.txt | 371 +++++++++++++++++++++++++++ nx-X11/extras/rman/contrib/gzip.patch | 46 ++++ nx-X11/extras/rman/contrib/hman.cgi | 7 + nx-X11/extras/rman/contrib/hman.ksh | 9 + nx-X11/extras/rman/contrib/hman.pl | 261 +++++++++++++++++++ nx-X11/extras/rman/contrib/http-rman.c | 200 +++++++++++++++ nx-X11/extras/rman/contrib/http-rman.html | 21 ++ nx-X11/extras/rman/contrib/lewis.pl | 17 ++ nx-X11/extras/rman/contrib/man2html | 108 ++++++++ nx-X11/extras/rman/contrib/rman_html_split | 324 +++++++++++++++++++++++ nx-X11/extras/rman/contrib/rman_html_split.1 | 71 +++++ nx-X11/extras/rman/contrib/sco-wrapper.sh | 6 + nx-X11/extras/rman/contrib/sutter.txt | 155 +++++++++++ nx-X11/extras/rman/contrib/youki.pl | 195 ++++++++++++++ 16 files changed, 1971 insertions(+) create mode 100644 nx-X11/extras/rman/contrib/README-contrib create mode 100644 nx-X11/extras/rman/contrib/authried.txt create mode 100644 nx-X11/extras/rman/contrib/bennett.txt create mode 100644 nx-X11/extras/rman/contrib/gzip.patch create mode 100644 nx-X11/extras/rman/contrib/hman.cgi create mode 100644 nx-X11/extras/rman/contrib/hman.ksh create mode 100644 nx-X11/extras/rman/contrib/hman.pl create mode 100644 nx-X11/extras/rman/contrib/http-rman.c create mode 100644 nx-X11/extras/rman/contrib/http-rman.html create mode 100644 nx-X11/extras/rman/contrib/lewis.pl create mode 100644 nx-X11/extras/rman/contrib/man2html create mode 100644 nx-X11/extras/rman/contrib/rman_html_split create mode 100644 nx-X11/extras/rman/contrib/rman_html_split.1 create mode 100644 nx-X11/extras/rman/contrib/sco-wrapper.sh create mode 100644 nx-X11/extras/rman/contrib/sutter.txt create mode 100644 nx-X11/extras/rman/contrib/youki.pl (limited to 'nx-X11/extras/rman/contrib') diff --git a/nx-X11/extras/rman/contrib/README-contrib b/nx-X11/extras/rman/contrib/README-contrib new file mode 100644 index 000000000..2d6885d91 --- /dev/null +++ b/nx-X11/extras/rman/contrib/README-contrib @@ -0,0 +1,144 @@ +This directory contains files contributed by PolyglotMan users. These +files are not installed, supported or regularly updated to work with +new versions of PolyglotMan. They are included because some may find +them useful, and if so they prevent duplication of effort. + +-- + +* sutter.txt - "Edward L. Sutter" + +"...converting "man" directories with their typical sub-directories of +man1, man2, etc... to an equivalently structured "html" directory with +the same sub-directory heirarchy." + +"I added an option to rman that allows it to search for the files over +a specified set of directories. This allows (for example) manpages under +man1 that reference something under man3 to be properly linked." + +-- + +* bennett.txt - Anne Bennett + +"... I applied the mods in contrib/sutter.txt, and then amplified +them. I append the relevant context diffs. In short, I added options +"-P" (a URL prefix for use with the paths found by "-S"), and "-H" and +"-F" (header and footer HTML files to help adjust the style of the +resulting page, for example by adding company logos, +return-to-home-page buttons, etc.)." + +-- + +* authried.txt - Erwin Authried + +"I wrote a small perl script (it's a quick hack) to view man-pages +with the web-browser." + +-- + +* gzip.patch - Todd Larason + +"I keep several manpage hierarchies locally, for easy comparison when +programming for multiple unix machines, most of which are across a +relatively slow link. To save disk space, I keep them gzipped. + +"Here's a small patch to make .so handling work against gzipped files. +It's a late-night-after-a-long-day hack, but it seems clean enough. If +you think there might be any interest, feel free to include it either in +rman itself or the contrib directory. It's against 3.0a3." + +-- + +* man2html - Marc Donner (donner@fid.morgan.com) + +A Korn Shell script that is moderately generic. It takes all the +files in a directory or a set of directories and does them one at a +time, putting the html output somewhere appropriate. The only +infelicity in the script is the stuff with localeo (local electronic +office) which is a hack put together to tweak the URLs not to refer to +localhost, which is broken right now, but directly to the local +server's alias. + +--- + +* sco-wrapper.sh - Dag Nygren + +SCO puts the names of valid man page sections in the file /etc/default/man. +This wrapper extracts the names from this file and passes them on to +PolyglotMan for use in determining man page cross references. + +--- + +* http-rman.{c,html} - Fredrik Lundh + +An HTTP server using PolyglotMan to produce hypertext renditions of +man-pages on the fly. + +--- + +* lewis.pl - Herb Lewis + +CGI bin script written in Perl. + +--- + +* hman.{cgi,ksh,pl} by teto@geocities.com +A more recent version may be available at http://www.geocities.com/SiliconValley/Lakes/8777/hman.html + + hman.cgi An example of a cgi-bin wrapper to launch hman.pl + Ideally, all customization should occur here + hman.ksh A stand-alone (non-browser) version of hman.cgi + hman.pl The core of the PolyglotMan front-end + +"I've written a man to html front-end that appears to have unique features: +A second attempt to locate related man pages is made if the original +inquiry fails + +"Since PolyglotMan can filter nroff's output or can work with raw +nroff files, this viewer allows selection of the actual man page +file. Thus either raw or cooked man pages can be selected directly. + +"The program is basic perl, but the implementation allows all customization +to be embodied in enviroment variables that should be set in a cgi-bin +wrapper." + +-- + +* youki.pl - Youki Kadobayashi + +CGI bin script written in Perl 5, and using CGI.pm +and thus "it can be accelerated with mod_perl". + +--- + +rman_html_split - Robert Moniot +rman_html_split.1 + +Breaks up rman HTML output in file (or standard input) into separate +section files, placing them into a directory. With manual page. + +--- + +Other converters are not included in this directory, but rather are +available over the net: + +* bsdi-man.pl - Fritz Heinrichmeyer + +Available at: http://ES-sun2.fernuni-hagen.de + + +* bbc_man2html - Brooks Cutter (brooks@paradyne.com) + +Available at: http://www.stuff.com/~bcutter/home/programs/bbc_man2html.html + + +* rman.pl - Alex Gagin + +Available at: http://www.jinr.dubna.su/~gagin/rman.pl.html + +(Be aware that the communications link is slow.) + + +* manner.pl - Ray W. Hiltbrand + +Available at: ftp://ftp.eng.auburn.edu/pub/rayh/man2html/manner.pl + diff --git a/nx-X11/extras/rman/contrib/authried.txt b/nx-X11/extras/rman/contrib/authried.txt new file mode 100644 index 000000000..7bdbc4023 --- /dev/null +++ b/nx-X11/extras/rman/contrib/authried.txt @@ -0,0 +1,36 @@ +#!/usr/local/bin/perl + +require "common.pl"; + +$webmaster="webadmin\@domain"; +$man_path="/usr/local/man:/usr/man:/usr/X11/man:/usr/lib/teTeX/man"; +$manpage_and_section = $ENV{"QUERY_STRING"}; +$rman="/usr/local/bin/rman -f HTML"; + +($manpage,$section)=split("[&]",$manpage_and_section); + + + split(":",$man_path); + foreach(@_){ + $file=join("", $_, "/man", $section,"/",$manpage,".",$section); + +# printf("try %s\n", $file); + + if (-e $file) { + exec "echo Content-Type:text/html; echo; cat $file | $rman"; + } + elsif (-e join("",$file,".gz")){ + exec "echo Content-Type:text/html; echo; zcat $file | $rman"; + } + + $file=join("",$file,"x"); + if (-e $file) { + exec "echo Content-Type:text/html; echo; cat $file | $rman"; + } + elsif (-e join("",$file,".gz")){ + exec "echo Content-Type:text/html; echo; zcat $file | $rman"; + } + + } + +&return_error(500,"man2html error","could not find manual page."); diff --git a/nx-X11/extras/rman/contrib/bennett.txt b/nx-X11/extras/rman/contrib/bennett.txt new file mode 100644 index 000000000..116d74d46 --- /dev/null +++ b/nx-X11/extras/rman/contrib/bennett.txt @@ -0,0 +1,371 @@ +*** rman.c.original Tue Jul 16 21:19:49 1996 +--- rman.c Tue Aug 27 15:59:38 1996 +*************** +*** 1,5 **** +--- 1,9 ---- + static char rcsid[] = "$Header: /cvs/xorg/xc/extras/rman/contrib/bennett.txt,v 1.1.1.4 2004/03/14 08:29:12 eich Exp $"; + ++ /* ELS: SearchDirs by "Edward L. Sutter" */ ++ /* AB: HTMLHeader and HTMLFooter by Anne Bennett */ ++ /* AB: SearchDirsPrefix by Anne Bennett */ ++ + /* + RosettaMan + +*************** +*** 265,271 **** +--- 269,278 ---- + + /*** utility functions ***/ + ++ /* 1996/08/26 Anne Bennett patched */ ++ int HrefSearch(char *manname, char *section); + ++ + /* case insensitive versions of strcmp and strncmp */ + + int +*************** +*** 1338,1343 **** +--- 1345,1355 ---- + char *manTitle = MANTITLEPRINTF; + char *manRef = MANREFPRINTF; + int fmanRef=1; /* valid man ref? */ ++ /* 1996/08/26 Anne Bennett patched */ ++ char *SearchDirs=0; /* ELS: added for smarter external reference generator. */ ++ char *SearchDirsPrefix=0; /* AB: added for HREF prefix to manpage path. */ ++ char *HTMLHeader=0; /* AB: added for HTML header and footer files. */ ++ char *HTMLFooter=0; /* AB: added for HTML header and footer files. */ + + /* + * HTML +*************** +*** 1349,1354 **** +--- 1361,1373 ---- + int i,j; + int lasttoc; + char *p, *p0; ++ /* 1996/08/26 Anne Bennett patched */ ++ /* AB: To support HTMLHeader and HTMLFooter */ ++ #define SUB_MANNAME "@@MANPAGE_NAME@@" ++ #define SUB_MANSECT "@@MANPAGE_SECTION@@" ++ #define STRING_SIZE 1024 ++ char line[STRING_SIZE]; ++ FILE *fp; + + /* always respond to these signals */ + switch (cmd) { +*************** +*** 1397,1402 **** +--- 1416,1474 ---- + /* better title possible? */ + printf(""); printf(manTitle, manName, manSect); printf("\n"); + printf("\n\n"); ++ /* 1996/08/26 Anne Bennett patched */ ++ /* AB: added HTMLHeader file, if -H option is set */ ++ if (HTMLHeader) { ++ if ((fp = fopen(HTMLHeader,"r")) == NULL) { ++ fprintf(stderr,"Could not open HTMLHeader file\n"); ++ } ++ else { ++ /* Output the header file, replacing strings as needed */ ++ while (fgets(line, STRING_SIZE, fp) != (char *)NULL) { ++ char *walker, *found; ++ int i; ++ ++ /* replace man section */ ++ walker = line; ++ while ( ( found = strstr(walker, SUB_MANSECT) ) != NULL ) { ++ if ( ( strlen(line) + strlen(manSect) ++ - strlen (SUB_MANSECT) ) > sizeof(line) ) { ++ fprintf(stderr,"Cannot substitute %s for %s; " ++ "line would be too long:\n " ++ "%s\n", manSect, SUB_MANSECT, line); ++ walker = found + strlen(SUB_MANSECT); ++ } ++ else { ++ (void) memmove(found+strlen(manSect), ++ found+strlen(SUB_MANSECT), ++ strlen(found+strlen(SUB_MANSECT))+1); ++ memcpy(found, manSect, strlen(manSect)); ++ walker = found + strlen(manSect); ++ } ++ } ++ /* replace man name */ ++ walker = line; ++ while ( ( found = strstr(walker, SUB_MANNAME) ) != NULL ) { ++ if ( ( strlen(line) + strlen(manName) ++ - strlen (SUB_MANNAME) ) > sizeof(line) ) { ++ fprintf(stderr,"Cannot substitute %s for %s; " ++ "line would be too long:\n " ++ "%s\n", manName, SUB_MANNAME, line); ++ walker = found + strlen(SUB_MANNAME); ++ } ++ else { ++ (void) memmove(found+strlen(manName), ++ found+strlen(SUB_MANNAME), ++ strlen(found+strlen(SUB_MANNAME))+1); ++ memcpy(found, manName, strlen(manName)); ++ walker = found + strlen(manName); ++ } ++ } ++ printf("%s", line); ++ } ++ fclose(fp); ++ } ++ } + printf("%s

\n", TABLEOFCONTENTS); + I=0; + break; +*************** +*** 1424,1429 **** +--- 1496,1514 ---- + if (lasttoc==BEGINSUBSECTION) printf(""); + printf("\n"); + } ++ /* 1996/08/26 Anne Bennett patched */ ++ /* AB: added HTMLFooter file, if -F option is set */ ++ if (HTMLFooter) { ++ if ((fp = fopen(HTMLFooter,"r")) == NULL) { ++ fprintf(stderr,"Could not open HTMLFooter file\n"); ++ } ++ else { ++ /* Output the footer file */ ++ while (fgets(line, STRING_SIZE, fp) != (char *)NULL) ++ printf("%s", line); ++ fclose(fp); ++ } ++ } + printf("\n"); + break; + case BEGINBODY: break; +*************** +*** 1500,1510 **** + *p++='\0'; p0=p; + for (; *p && *p!=')'; p++) /* empty */; + *p='\0'; +! if (fmanRef) { printf(""); } + else printf(""); + break; + case ENDMANREF: +! if (fmanRef) printf(""); else printf(""); + break; + + case BEGINSC: case ENDSC: +--- 1585,1604 ---- + *p++='\0'; p0=p; + for (; *p && *p!=')'; p++) /* empty */; + *p='\0'; +! /* 1996/08/26 Anne Bennett patched */ +! /* ELS: added a call to HrefSearch() if the -S option is set.. */ +! if (SearchDirs) +! HrefSearch(hitxt,p0); +! else if (fmanRef) { +! printf(""); +! } + else printf(""); + break; + case ENDMANREF: +! /* 1996/08/26 Anne Bennett patched */ +! if (fmanRef || SearchDirs) printf(""); else printf(""); + break; + + case BEGINSC: case ENDSC: +*************** +*** 2744,2754 **** +--- 2838,2856 ---- + extern char *optarg; + extern int optind, opterr; + ++ /* 1996/08/26 Anne Bennett patched */ ++ /* ELS: added the -S option: */ ++ /* AB: added the -H and -F options */ ++ /* AB: added the -P option */ + char strgetopt[80]; + /* options with an arg must have a '<' in the description */ + struct { char letter; int arg; char *longnames; char *desc; } option[] = { + { 'f', 1, "filter", " " }, + { 'r', 1, "reference:manref:ref", " " }, ++ { 'S', 1, "searchdirs", " " }, ++ { 'P', 1, "prefix", " " }, ++ { 'H', 1, "header", " " }, ++ { 'F', 1, "footer", " " }, + { 'l', 1, "title", " " }, + { 'b', 0, "subsections:sub", " (show subsections)" }, + { 'n', 1, "name", "(ame of man page) <string>" }, +*************** +*** 2830,2835 **** +--- 2932,2953 ---- + case 'r': manRef = optarg; + if (strlen(manRef)==0 || strcmp(manRef,"-")==0 || strcmp(manRef,"off")==0) fmanRef=0; + break; ++ /* 1996/08/26 Anne Bennett patched */ ++ /* ELS: added the -S option: */ ++ /* AB: added the -H and -F options */ ++ /* AB: added the -P option */ ++ case 'S': SearchDirs = optarg; ++ if (strlen(SearchDirs)==0 ) SearchDirs=0; ++ break; ++ case 'P': SearchDirsPrefix = optarg; ++ if (strlen(SearchDirsPrefix)==0 ) SearchDirsPrefix=0; ++ break; ++ case 'H': HTMLHeader = optarg; ++ if (strlen(HTMLHeader)==0 ) HTMLHeader=0; ++ break; ++ case 'F': HTMLFooter = optarg; ++ if (strlen(HTMLFooter)==0 ) HTMLFooter=0; ++ break; + case 't': TabStops=atoi(optarg); break; + case 'm': fMan=0; break; + case 'T': fTable=1; break; +*************** +*** 2904,2906 **** +--- 3022,3126 ---- + filter(); + return 0; + } ++ ++ ++ /* 1996/08/26 Anne Bennett patched */ ++ /* ELS... ++ HrefSearch(): ++ Active only with command line option -S... ++ Called when rman -fHTML has determined that it is going to add a ++ hypertext link. The user tells rman where to search for the hypertext ++ links (local machine search only) and if HrefSearch() finds the file ++ ++ SRCHDIR/manname.section ++ ++ where ++ SRCHDIR is one of the colon-delimited paths specified with ++ the -S option; ++ manname is the text that rman found preceding a "manname(##)" ++ detection; ++ section is the string within the parens of the manname spec; ++ ++ ++ then it will use that path to build the HREF line. If not found, ++ then <A> is all that is inserted. ++ This is generally only helpful when you are simply attempting to ++ turn a man directory into an html directory. ++ ++ Note that if the first char of SearchDirs is a colon, then if ++ HrefSearch does not find the reference, it defaults to what rman ++ used to do (use manRef, -r option); otherwise, it will not add ++ a hypertext link at all. ++ */ ++ int HrefSearch(char *manname, char *section) ++ { ++ char *dir, *colon, tmp; ++ int DefaultToManRef; ++ FILE *fp; ++ static char path[256]; ++ ++ tmp = 0; ++ ++ again: ++ if (SearchDirs[0] == ':') { ++ dir = &SearchDirs[1]; ++ DefaultToManRef = 1; ++ } ++ else { ++ dir = SearchDirs; ++ DefaultToManRef = 0; ++ } ++ ++ /* Make 2 passes on all search directories... */ ++ /* First pass is with the path dir/manname.section */ ++ /* Second pass is with the path dir/manname.section[0] */ ++ /* This allows the spec manname(3x) to be found as manname.3 */ ++ /* just in cast manname.3x doesn't exist. */ ++ /* Note that the second pass is only necessary if the section */ ++ /* string is more than one character in length. */ ++ while(1) { ++ colon = strchr(dir,':'); ++ if (colon) *colon = 0; ++ sprintf(path,"%s/%s.%s.html",dir,manname,section); ++ /* 1996/08/26 Anne: read-only, not rw, please. */ ++ if ((fp = fopen(path,"r")) != NULL) { ++ printf("<A HREF=\""); ++ /* AB: Put in the manpage location prefix */ ++ if (SearchDirsPrefix) ++ printf("%s",SearchDirsPrefix); ++ printf("%s",path); ++ printf("\">"); ++ fclose(fp); ++ if (colon) *colon = ':'; ++ fprintf(stderr,"HREF @ %s\n",path); ++ return(1); ++ } ++ if (colon) { ++ *colon = ':'; ++ dir = colon+1; ++ } ++ else ++ break; ++ } ++ if (section[1]) { ++ tmp = section[1]; ++ section[1] = 0; ++ dir = SearchDirs; ++ goto again; ++ } ++ if (tmp) ++ section[1] = tmp; ++ ++ /* 1996/08/27 Anne Bennett: use manRef only if set */ ++ if (DefaultToManRef && manRef) { ++ printf("<A HREF=\""); ++ printf(manRef, manname, section); ++ printf("\">"); ++ } ++ else ++ printf("<A>"); ++ return(1); ++ } ++ ++ /* End ELS additions. */ ++ +*** rman.1.original Tue Jul 16 21:19:49 1996 +--- rman.1 Tue Aug 27 15:16:29 1996 +*************** +*** 75,80 **** +--- 75,109 ---- + or `off', then man page references will not be HREFs, just set + in italics. + .TP 15 ++ -S|--searchDirs \fIcolon-separated-directories \fR ++ Valid only with \fI-fHTML \fR, this option modifies the behaviour of ++ rman when inserting a hyperlink to a referenced manpage. ++ The directories indicate where to look ++ for a pre-HTMLized version of the referenced manpage under the name ++ " \fIname \fR. \fIsection \fR. \fIhtml \fR". If the file is not ++ found, no hypertext link is added, except if the first character of ++ the directories list is a colon, in which case a link is added using ++ manRef, ( \fI-r \fR option). ++ .TP 15 ++ -P|--prefix \fIstring \fR ++ Valid only with \fI-S \fR, the string indicates what prefix to add to ++ the path when constructing the hyperlink for a referenced manpage. ++ The string will usually be ++ similar to that given with \fI-r \fR, except that there will be no ++ printf-style escapes, for example "http://localhost/manpages". ++ .TP 15 ++ -H|--header \fIfilename \fR ++ Valid only with \fI-fHTML \fR, the filename refers to a file ++ containing an HTML "header", which might consist of, for example, a ++ company logo, or body color specifications. If the strings ++ "@@MANPAGE_NAME@@" or "@@MANPAGE_SECTION@@" are found in this file, ++ they are replaced by the appropriate manpage name and section. ++ .TP 15 ++ -F|--footer \fIfilename \fR ++ Valid only with \fI-fHTML \fR, the filename refers to a file ++ containing an HTML "footer", which might consist of, for example, a ++ link back to the site's home page. ++ .TP 15 + -s|section \fI# \fR + Set volume (aka section) number of man page (used in roff format). + .TP 15 + diff --git a/nx-X11/extras/rman/contrib/gzip.patch b/nx-X11/extras/rman/contrib/gzip.patch new file mode 100644 index 000000000..d10666b6a --- /dev/null +++ b/nx-X11/extras/rman/contrib/gzip.patch @@ -0,0 +1,46 @@ +--- rman.c.~1~ Wed Nov 20 13:33:52 1996 ++++ rman.c Fri Oct 24 00:10:56 1997 +@@ -3583,6 +3583,43 @@ + } + free(sobuf); + } ++ } else { ++#define GZIP "/bin/gzip" ++ char * gz = malloc(strlen(p)+3+1); ++ sprintf(gz, "%s.gz", p); ++ if (stat(gz, &fileinfo)==0) { ++ /* first, figure out how big */ ++ char * cmd = malloc(strlen(gz) + strlen(GZIP) + 7 + 1); ++ char buffer[512]; ++ unsigned long compr, uncomp; ++ FILE * proc; ++ sprintf(cmd, "%s -l \"%s\"", GZIP, gz); ++ proc = popen(cmd, "r"); ++ fgets(buffer, sizeof buffer, proc); /* label line */ ++ fgets(buffer, sizeof buffer, proc); /* length line */ ++ sscanf(buffer, "%lu %lu", &compr, &uncomp); ++ fclose(proc); ++ /* Boy, don't you wish stat would do that? */ ++ sobuf = malloc(uncomp + 1); ++ if (sobuf!=NULL) { ++ /* suck in entire file, as above */ ++ sprintf(cmd, "%s -dc \"%s\"", GZIP, gz); ++ proc = popen(cmd, "r"); ++ if (proc!=NULL) { ++ if(fread(sobuf, 1, uncomp, proc)) { ++ sobuf[uncomp]='\0'; ++ for (q=sobuf; (q=strstr(q," \\}"))!=NULL; q+=3) *q='\n'; ++ source_subfile(sobuf); ++ err = 0; ++ } ++ fclose(proc); ++ } ++ free(sobuf); ++ } ++ free(cmd); ++ } ++ free(gz); ++ + } + + if (err) { diff --git a/nx-X11/extras/rman/contrib/hman.cgi b/nx-X11/extras/rman/contrib/hman.cgi new file mode 100644 index 000000000..540899c03 --- /dev/null +++ b/nx-X11/extras/rman/contrib/hman.cgi @@ -0,0 +1,7 @@ +#!/bin/ksh +########## +export MANPATH=/trane/mach/man:/trane/share/man:/usr/man:/usr/X11/man:/usr/openwin/man:/var/man +export PATH=/trane/mach/bin:/trane/share/bin:$PATH +export HMANPRG=rman +export HMANOPT='-b -f html' +exec /home/teto/dev/hman/hman.pl diff --git a/nx-X11/extras/rman/contrib/hman.ksh b/nx-X11/extras/rman/contrib/hman.ksh new file mode 100644 index 000000000..99df60107 --- /dev/null +++ b/nx-X11/extras/rman/contrib/hman.ksh @@ -0,0 +1,9 @@ +#!/bin/ksh +########## +export MANPATH=/trane/mach/man:/trane/share/man:/usr/man:/usr/X11/man:/usr/openwin/man:/var/man +export PATH=/trane/mach/bin:/trane/share/bin:$PATH +export HMANPRG=rman +export HMANOPT='-b -f html' +export QUERY_STRING='DirectPath=/usr/man/cat4.Z/cdf.4' +export QUERY_STRING='ManTopic=test&ManSection=key' +perl -d /home/teto/dev/hman/hman.pl diff --git a/nx-X11/extras/rman/contrib/hman.pl b/nx-X11/extras/rman/contrib/hman.pl new file mode 100644 index 000000000..099db0417 --- /dev/null +++ b/nx-X11/extras/rman/contrib/hman.pl @@ -0,0 +1,261 @@ +#!/usr/bin/perl -w +#!/citi/gtfd/mach/bin/perl -w +############### +# $Id: hman.pl,v 1.1.1.4 2004/03/14 08:29:12 eich Exp $ +# $Source: /cvs/xorg/xc/extras/rman/contrib/hman.pl,v $ +############################################ +# TODO: +# reorganize location of man pages - move 3x stuff from man3 to man3x +# recurse - if 'man 3x curses' does not work try 'man 3 curses' +# display more STDERR +# Fix broken whatis entries - instead of +# manpage section - description +# manpage description section - +# highlite keywords found +# pass MANPATH as a command line argument +############################################ +# Inspired by: +# http://www.jinr.dubna.su/~gagin +# http://thsun1.jinr.dubna.su/~gagin/rman.pl +# http://thsun1.jinr.dubna.su/cgi-bin/rman.pl +# http://www.jinr.dubna.su/~gagin/rman.pl.html +# +# CGI form interface to PolyglotMan program, which is available as +# ftp://ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z +# +# The most recent version of this program available as +# http://www.geocities.com/SiliconValley/Lakes/8777/hman.html +#--------------------------------------------------------------------- +# This 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, or (at your option) +# any later version. +# +# hman 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 software; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# +# THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE +# CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE +# PERFOHMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT +# NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE +# SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE +# SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE +# PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). +# ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES +# IS SPECIFICALLY DISCLAIMED. +#--------------------------------------------------------------------- +# Request form: hman.pl?ManTopic=SOMETOPIC&ManSection=SECTION +# Request form: hman.pl?DirectPath=filename +# +#--------------------------------------------------------------------- +# Stuff to change + +# path to PolyglotMan program. "-b" is not nessesary +$hman="$ENV{HMANPRG} $ENV{HMANOPT}"; + +# path to man program +$ManPrg='/usr/bin/man'; + +# path to cat program +$ENV{PAGER} = '/bin/cat'; + +# path to man directories +($ManPathFind = $ENV{MANPATH}) =~ s/:/ /g; + +# URL to this program +$hmanpl='/cgi-bin/hman'; + +# if man produced number of lines less then follows, +# I assume that request failed +$emptyman=5; + +# tail of every produced html document +$HtmlTail='<hr><A HREF="' . $hmanpl . '">Back to Hman</a>'; +# $HtmlTitle="<title>CGI form interface to PolyglotMan\n"; +$HtmlHdr="Content-type: text/html\n\n"; + +# end changable things +#---------------------------------------------------------------------- +@ManSections = ( + '1', 'user commands', + '2', 'system calls', + '3', 'subroutines', + '4', 'devices', + '5', 'file formats', + '6', 'games', + '7', 'miscellanious', + '8', 'sys. admin.', + '9', 'Linux Internals', + 'n', 'section n' +); + +# Set unbuffered I/O. Prevents buffering problems with +# "system()" calls. +select((select(STDOUT), $| = 1)[0]); +print $HtmlHdr; + +$string = $ENV{QUERY_STRING}; +# +# Initial Form +# +if($string eq "") { initialForm(); } + +# +# Generic parameter parsing ... +# +$DirectPath = $ManSection = $ManTopic = ""; +$string =~ s/&/'; \$/g; +$string =~ s/=/='/g; +$string =~ s/^(.*)$/\$$1';/; +eval $string; + +hmanDirect($DirectPath) if ($DirectPath ne ""); + +if ($ManTopic eq "") { badness("Topic for man search needed\n"); } + +if ($ManSection eq "") { badness("No section specified\n"); } + +$ManSection =~ s/all//; +if ($ManSection =~ /key/) { manKey($ManTopic); } + +findIt($ManTopic); +open(MANOUT, "$ManPrg $ManSection $ManTopic |") + || die "$hmanpl: can't run \"$ManPrg Section $ManTopic |\", $!\n"; +for (0..$emptyman) { + $temp = || last; + push @temp, $temp; +} +# +if (@temp < $emptyman) { + close(MANOUT); + print"Request failed for topic $ManTopic:\n"; + for (@temp) {print;} + print "

Let's try a keyword search:


\n"; + manKey($ManTopic); +} +# +$cmd = "$hman -r \"$hmanpl?ManTopic=%s&ManSection=%s\" -l \"Man page for $ManTopic"; +if ($ManSection eq "") { + $cmd .= '"'; +} else { + $cmd .= "($ManSection)\""; +} +# +open(HMANIN, "| $cmd") || die "$hmanpl: can't open $cmd: $!\n"; +for (@temp) {print HMANIN;} +while(){print HMANIN;} +close(MANOUT); +close(HMANIN); + +exitIt(); +############################################################################### +sub initialForm { + print <Select a manual page: +
+ + + + + + + + + + + + +
Section: +
Topic:
+ +
+
+EOF + exitIt(); +} +sub findIt { + my($topic) = ($_[0]); + my($cmd, $mixedCase, $navigation, $zcat); + $mixedCase = ''; + foreach (split(/\s*/, $topic)) { + $mixedCase .= "[" . $_ . uc($_) . "]"; + } + $cmd = 'find ' . $ManPathFind . ' \( -type f -o -type l \) -name ' + . $mixedCase .'\* | sort -t. +1'; + open(FINDIN, "$cmd |") || die "can't open pipe \"$cmd |\": $!"; + $navigation = 0; + while () { + if ($navigation == 0) { + print "
    \n"; + $navigation = 1; + } + $_ =~ s/[\n\r]*$//; + print "
  • $_\n"; + } + close(FINDIN); + print "

\n" if ($navigation == 1); +} +sub hmanDirect { + my($path) = ($_[0], $_[1]); + my($cmd, $dir, $topic, $section); + ($dir = $path) =~ s/\.(gz|z|Z)$//; + ($topic = $dir) =~ s,^.*/,,; + $dir =~ s,/[^/]*/[^/]*$,,; + # $dir =~ s,/[^/]*$,,; + ($section=$topic)=~s/^.*\.([^\.]*)$/$1/; + $topic =~ s/\.[^\.]*$//; + findIt($topic); + $cmd = "cd $dir; (gzip -dc < $path 2>/dev/null || cat < $path) | $hman -r '" + . $hmanpl . '?ManTopic=%s&ManSection=%s' ."' -l 'Man page for $topic($section)'"; + system($cmd) || warn "can't run command \"$cmd\": $!"; + print $HtmlTail; + exit 0; +} +sub exitIt { + print $HtmlTail; + exit 0; +} +sub badness { + my($text) = ($_[0]); + print "Request failed: $text, Try again
\n"; + initialForm(); +} +sub manKey { + my($topic) = ($_[0]); + open(TMPHTML,"$ManPrg -k $topic | sort -u |") + || die "can't open pipe \"$ManPrg -k $topic | sort -u |\": $!\n"; + print "Keyword search results for \"$topic\"\n"; + print "

Keyword search results for \"$topic\"


\n"; + while() { + s/\( \)//g; + next if (! /^([^(]+)\s*\(([^)]+)[^-]+-\s(.*)[\n\r]*$/); + @topics=split(/, /,$1); + next if ($2 eq ""); + print "

$3:

\n"; + print "
    \n"; + for $topic (@topics) { + print "
  • $topic($2)\n"; + } + print "
\n"; + } + close(TMPHTML); + exitIt(); +} diff --git a/nx-X11/extras/rman/contrib/http-rman.c b/nx-X11/extras/rman/contrib/http-rman.c new file mode 100644 index 000000000..687a8fc36 --- /dev/null +++ b/nx-X11/extras/rman/contrib/http-rman.c @@ -0,0 +1,200 @@ +/* $Id: http-rman.c,v 1.1.1.4 2004/03/14 08:29:12 eich Exp $ + * + * Name: + * http-rman.c -- a rudimentary man-page HTTP server + * + * Description: + * This is a minimal HTTP server using RosettaMan by T.A. Phelps + * (phelps@ACM.org) to produce hypertext renditions + * of man-pages on the fly. + * + * This server processes URLs with the following syntax: + * + * [/man] ? [ ?
] + * + * For URLs matching this format, it pipes the output of + * man
through rman and sends it to + * the HTTP client. For other URLs, it returns the document + * given as argv[1] (using cat(1). The leading /man is + * optional, but is strongly recommended. + * + * This server is shipped as two files, the http-rman.c + * sources and the http-rman.html sample frontpage. I have + * not included a Makefile; you can write your own or just + * type [g]cc -o http-rman http-rman.c + * + * What do I need to run this: + * If you don't have it, pick up RosettaMan by anonymous ftp + * from ftp.cs.berkeley.edu: /ucb/people/phelps/tcl/rman.tar.Z + * + * You'll also need an HTTP client such as NCSA Mosaic to talk + * to this server. Mosaic is available by anonymous FTP from + * ftp://ftp.ncsa.uiuc.edu/Mosaic + * + * Both RosettaMan (rman) and Mosaic are available from many + * other sites. Try Archie, or check your local or national net + * archive. + * + * How do I get it running: + * First, compile the server (see above), and install it + * somewhere. + * + * The server runs under inetd(8). Add a service to + * /etc/services, say: + * + * http-rman 4080/tcp + * + * If you're not about to install another HTTP server on your + * machine, you may use the default HTTP port, 80, instead. + * + * Then add an entry to /etc/inetd.conf, such as (on a single line): + * + * http-rman stream tcp nowait root /usr/local/bin/http-rman + * http-rman /usr/local/lib/rman/http-rman.html + * + * Change /usr/local/bin and /usr/local/lib/rman to where you + * installed the two files. In addition, you may wish to run + * the server as something other than root... + * + * Restart inetd(8) (use kill -HUP or kill it and start it again) + * and try the following: + * + * $ Mosaic http://localhost:4080 + * + * If you don't have Mosaic, try the following instead: + * + * $ telnet localhost 4080 + * Trying 127.0.0.1... + * Connected to localhost. + * Escape character is '^]'. + * GET /man?ls + * + * HTTP/1.0 200 OK + * ... + * + * Portability: + * You'll need an ANSI compiler (or an editor and some patience). + * As it stands right now, this code has been successfully + * compiled on OSF/1 AXP using cc, and on SunOS 4.1 using gcc. + * Might need some tuning for other platforms. + * + * Legal Issues: + * Check the external visibility of the http-rman service + * you choose. This server gives a user access to ALL man- + * pages on your machine. You may have installed copyrighted + * software (your operating system, for example) with + * man-pages that you are NOT allowed to make visible for + * anyone out there... + * + * History: + * 94-04-30 fl: created + * 94-05-13 fl: stripped away everything but rman support + * + * Copyright (c) Fredrik Lundh 1994 (fredrik_lundh@ivab.se) + * All rights reserved. + */ + + +#include /* printf(), fflush(stdio) etc */ +#include /* strrchr(), strcmp() etc */ + + +static int +http_error(int error) +{ + char *p; + + switch (error) { + case 400: + p = "Bad Request"; + break; + case 404: + p = "Not Found"; + break; + default: + p = "Error"; + } + printf("HTTP/1.0 %d %s\r\n", error, p); + printf("MIME-version: 1.0\r\n"); + printf("Content-Type: text/html\r\n\r\n"); + printf("%d %s\r\n", error, p); + printf("

%d %s

\r\n", error, p); + return 0; +} + + +static int +http_rman(char *url) +{ + char *pName; + char *pSection; + char buf[200]; + + /* parse URL: should be /man?command[?section] */ + pSection = strrchr(url, '?'); + if (!pSection) { + return -1; + } + pName = pSection-1; + *pSection++ = '\0'; + + pName = strrchr(url, '?'); + if (!pName) { + pName = pSection; + pSection = ""; + } + else + pName++; + + sprintf(buf, "man %s %s | rman -r \"man?%%s?%%s\" -n %s -f html", + pSection, pName, pName); + + return system(buf); +} + + +int +main(int ac, char **av) +{ + char buf[200]; + char url[200]; + int status; + char *sFrontpage = "/usr/local/lib/rman/http-rman.html"; + +/* check arguments */ + + if (ac > 1) + sFrontpage = av[1]; + +/* just read in one line from stdin and make sure it is a GET +command */ + + if (gets(buf)) { + + /* read rest of command (just for the sake of it) */ + while (gets(url) && url[0] != '\r') + ; + + /* command should be GET [HTTP/1.0] */ + if (sscanf(buf, "GET %s", url) == 1) { + + status = http_rman(url); + + if (status < 0) { + sprintf(buf, "cat %s", sFrontpage); + if (system(buf) == 0) + status = 0; + } + + if (status < 0) + http_error(404); + + } else + + http_error(400); + } + + fflush(stdout); + + exit(0); +} diff --git a/nx-X11/extras/rman/contrib/http-rman.html b/nx-X11/extras/rman/contrib/http-rman.html new file mode 100644 index 000000000..ec4cb5973 --- /dev/null +++ b/nx-X11/extras/rman/contrib/http-rman.html @@ -0,0 +1,21 @@ +HTTP/1.0 200 OK +Server: http-rman 1.0 +MIME-Version: 1.0 +Content-Type: text/html +Content-Transfer-Encoding: binary + + + + +RosettaMan Gateway +

RosettaMan Gateway

+ +This is a gateway to the man pages on this machine. Please enter the +function or command you want to know more about. +

+ +

+The hypertext man-pages are generated on the fly using the excellent +RosettaMan utility by T.A. Phelps. This minimal +HTTP-server was written by Fredrik Lundh. + diff --git a/nx-X11/extras/rman/contrib/lewis.pl b/nx-X11/extras/rman/contrib/lewis.pl new file mode 100644 index 000000000..116b652c2 --- /dev/null +++ b/nx-X11/extras/rman/contrib/lewis.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +# Syntax: man2html

+ +# Print out a content-type for HTTP/1.0 compatibility +print "Content-type: text/html\n\n"; + +if( $ENV{'REQUEST_METHOD'} eq "GET" ) +{ + $buffer=$ENV{'QUERY_STRING'} ; + @ARGV = split(/&/,$buffer) ; +} + +@manpage = `man @ARGV[1] @ARGV[0] | rman -f html -n @ARGV[0] -s +@ARGV[1]`; + +print "@manpage"; diff --git a/nx-X11/extras/rman/contrib/man2html b/nx-X11/extras/rman/contrib/man2html new file mode 100644 index 000000000..3df77a3a8 --- /dev/null +++ b/nx-X11/extras/rman/contrib/man2html @@ -0,0 +1,108 @@ +#!/bin/ksh + +# Take a man tree and make an html tree out of it + +DOMAIN=$(domainname) +ARCH=$(arch) + +case ${DOMAIN} in + acf) localeo=reo1 ;; + bwfid) localeo=reo1 ;; + chfid) localeo=neo1 ;; + hkfid) localeo=teo1 ;; + lnfid) localeo=leo1 ;; + nyfid) localeo=neo1 ;; + psfid) localeo=leo1 ;; + sffid) localeo=neo1 ;; + tkfid) localeo=teo1 ;; + esac + +sections="{1,2,3,4,5,6,7,8}" +from=/usr/man +to=/u/eo/repository/system/unix/man + +function disambiguate +{ +newbase=${1} +newname="${newbase}.1" +dis=2 +while [ -a "${newname}" ] + do + newname=$newbase"."$dis + dis=$(expr $dis + 1) + done +} + +while getopts f:t:l:is:v c + do + case $c in + f) from=$OPTARG ;; + t) to=$OPTARG ;; + l) localeo=$OPTARG ;; + i) indexonly=1 ;; + s) sections=$OPTARG ;; + v) verbose=1 ;; + esac + done +shift OPTIND-1 + +if [ "${verbose}" ] + then + print "from: $from" + print "to: $to" + print "localeo: $localeo" + print "sections: $sections" + if [ "${indexonly}" ] + then + print "indexonly: 1" + fi + fi + +cd $from + +if [ ! "${indexonly}" ] + then + print "Processing the man pages ..." + for i in man${sections}/* + do + if [ "$verbose" ] + then + print $i + fi + # n=${i%.*} + name=${to}/${i} + if [ -a "${name}" ] + then + oldname=$name + disambiguate $name + name=$newname + print "Collision - ${oldname} will be stored as ${name}" + fi + eqn $i | tbl | nroff -man | rman -f HTML | sed -e "s/MS_LOCAL_HOST/${localeo}/g" > ${name} + done + fi + +print "Building the index.html files ..." +cd $to +for i in man${sections} + do + if [ "$verbose" ] + then + print $i + fi + cd $i + rm -f index.html + echo '
    ' > ../new.html + for j in * + do + if [ "$verbose" ] + then + print -n "$j " + fi + print + print "
  • $j" >> ../new.html + done + echo '
' >> ../new.html + mv ../new.html index.html + cd .. + done diff --git a/nx-X11/extras/rman/contrib/rman_html_split b/nx-X11/extras/rman/contrib/rman_html_split new file mode 100644 index 000000000..aafb023c5 --- /dev/null +++ b/nx-X11/extras/rman/contrib/rman_html_split @@ -0,0 +1,324 @@ +#!/bin/sh +# +# Script to break up rman html output into separate sections in a directory. +# +# Author: Robert Moniot +# Date: 4 Aug 1998 +# + +version="rman_html_split V1.0 (c) 1998 Robert K. Moniot" + + # Usage function prints synopsis and exits +Usage(){ + myname=`echo $0 | sed -e 's,.*/,,'` +cat < + +$* + + +EOF +do_title +} + + # This function puts out the title with name of manpage +do_title(){ + if [ -n "$title" ] + then + echo "

$title

" + fi +} + + # This function puts out ref to table of contents that + # follows header for all but 1st and toc page. +do_href_toc(){ +cat <Table of Contents

+EOF +} + + # This function puts out ref to previous section +do_href_prev(){ + echo "

Previous: $2


" +} + + # This function puts out footer needed by all but last page. +do_footer(){ +cat < +EOF +} + + # This function changes the trailing NAME anchor + # of a section into an href to the next section. + # The first edit is for sections. The second edit + # handles the toc anchor, which has no href and so + # is missed by the first edit. +do_href_next(){ + sed -e '$s,^.*]*>\([^<]*\).*$,


Next: \2,' \ + -e '$s,]$/N' \ + -e 's/\n/ /' \ + -e 't top' $1 > $filename + + # If user did not supply title, get title for top of + # each page from rman-generated line. If user + # gave a blank title then leave it blank. +if [ -z "$title" -a -z "$notitle" ] +then + title=`sed -e '/^<TITLE>/q' $filename | + sed -n -e 's,^<TITLE>\([^<]*\).*$,\1,p'` +fi + + # Get a list of all the sections. Separate it into a + # list of merged sections and a list of all other sections. + # Merged sects are combined and get special treatment besides. +allsects=`sed -n 's,^.*<A NAME="\(sect[0-9][0-9]*\)".*$,\1,p' $filename` + +mergesects=`echo $allsects | \ + awk '{for(i=1; i<=NF && i<'"$mergesect"+2'; i++) print \$i;}'` + +sectlist=`echo $allsects | + awk '{for(i='"$mergesect"'+2; i<=NF; i++) print \$i;}'` + + +# This little bit, copied from GNU configure, sets ac_n and ac_c such +# that echo $ac_n "stuff $ac_c" yields "stuff " w/o following newline. +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + # Create html directory if it does not exist. +if [ -d $htmldir ] +then + echo "Re-using directory $htmldir." +else + echo "Creating directory $htmldir..." + if mkdir $htmldir + then + true + else + echo "Failed!" + exit 1 + fi +fi + +echo "Creating section pages..." + + # Produce index page. It is special, since it combines + # merged sections and uses the rman-generated header. +nextsect=`echo $sectlist | awk '{print $1;}'` +echo $ac_n $mergesects "$ac_c" +(do_title ; + sed -n -e "1,/^<H[23]><A NAME=\"$nextsect\"/p" $filename | \ + do_href_next | \ + change_hrefs ; + do_footer) > $htmldir/sect0.html + + # Produce pages for all other sections except toc. +prevsect="sect$mergesect" +prevtext=`sed -n 's,^<H[23]><A NAME="'$prevsect'" HREF="#toc[0-9][0-9]*">\([^<]*\).*$,\1,p' $filename | sed -e 's/ *$//'` +for sect in $sectlist; +do + echo $ac_n "$sect $ac_c" + headtext=`sed -n 's,^<H[23]><A NAME="'$sect'" HREF="#toc[0-9][0-9]*">\([^<]*\).*$,\1,p' $filename | sed -e 's/ *$//'` + (do_header $headtext ; + do_href_toc ; + do_href_prev "$prevsect" "$prevtext" ; + sed -n -e '/<A NAME="'$sect'"/,/<A NAME=/p' $filename | + do_href_next | + change_hrefs ; + do_footer) > $htmldir/$sect.html + prevsect="$sect" + prevtext="$headtext" +done + + + # Produce table of contents +echo "toc" +(do_header Table of Contents ; + sed -n -e '/<A NAME="toc">/,$p' $filename | \ + change_hrefs ; +) > $htmldir/toc.html + + + # Finally, make sure the symlinks index.html and + # sect1.html -> sect0.html are in place, and if not, + # create them. If --tocfirst is not specified, then + # link index.html to section 0, otherwise link it to + # index.html + +echo "Doing symlinks..." +cd $htmldir + +rm -f index.html +if [ -z "$tocfirst" ] +then + echo "Linking index.html -> sect0.html" + ln -s sect0.html index.html +else + echo "Linking index.html -> toc.html" + ln -s toc.html index.html +fi + +for sect in $mergesects +do + if [ "$sect" != "sect0" ] + then + echo "Linking $sect.html -> sect0.html" + rm -f $sect.html + ln -fs sect0.html $sect.html + fi +done + +echo "Done." diff --git a/nx-X11/extras/rman/contrib/rman_html_split.1 b/nx-X11/extras/rman/contrib/rman_html_split.1 new file mode 100644 index 000000000..5d3cb4d59 --- /dev/null +++ b/nx-X11/extras/rman/contrib/rman_html_split.1 @@ -0,0 +1,71 @@ +.TH rman_html_split 1 "4 Aug 1998" +.SH NAME +rman_html_split \- split rman html output into separate sections +.SH SYNOPSIS +.B rman_html_split +[ +.I options +] [ +.I file +] +.SH DESCRIPTION +The \fBrman_html_split\fP script reads a file containing HTML produced +from a manual page by the \fBrman\fP(1) program, and splits it into a +set of files, each containing one section or subsection of the manual. +Each section file has added to it an optional header identifying the +program described by the manual page, a link to the table of contents, +and links to the previous section and the next section. The separate +section files are placed in a subdirectory. A symbolic link named +\fIindex.\|html\fP is created in this subdirectory, linked to either +\fIsect0.\|html\fP (the first section) or \fItoc.\|html\fP (the table +of contents section). +.PP +Use this script to split a large manual page into smaller, more +manageable parts for use as online web-based documentation. +.SH OPTIONS +.TP +.BR "\-d \fIdir\fP" " | " "\-\-html\-dir \fIdir\fP" +Place output into directory \fIdir\fP. The default directory name is +\fIhtml\fP. +.TP +.BR "\-m \fInum\fP" " | " "\-\-merge \fInum\fP" +Merge sections 0 thru \fInum\fP into one file. The default for +\fInum\fP is 1, since usually section 0 is the NAME section and +section 1 is SYNOPSIS, which are usually both short and go well +together. Set +.I num +to 0 to prevent merging, or set it to a larger number to merge more +initial sections. Maximum value of \fInum\fP is 9. There is no +provision for merging sections other than consecutive numbers from +section 0. +.TP +.BR \-t " | " \-\-toc\-first +Link \fIindex.\|html\fP to the table of contents. By default, it is +linked to \fIsect0.\|html\fP. Use this if you prefer the initial page +to be the table of contents rather than the first section of the +manual page. +.TP +.BR "\-T \fItitle\fP" " | " "\-\-title \fItitle\fP" +Use \fItitle\fP as a header on top of each page. This header is +displayed using the H2 HTML tag. By default, \fBrman_html_split\fP uses +the title generated by \fBrman\fP. By making \fItitle\fP the empty +string (""), the header can be suppressed entirely. +.TP +.BR \-h " | " \-\-help +Print synopsis and exit. +.TP +.BR \-V " | " \-\-version +Print version information and exit. +.SH SEE ALSO +.BR man (1), +.BR rman (1). +.SH BUGS +You tell me. +.SH AUTHOR +Robert K. Moniot <moniot@fordham.edu> +.br +Fordham University +.br +Department of Computer and Information Sciences +.br +New York, NY diff --git a/nx-X11/extras/rman/contrib/sco-wrapper.sh b/nx-X11/extras/rman/contrib/sco-wrapper.sh new file mode 100644 index 000000000..95d7610ed --- /dev/null +++ b/nx-X11/extras/rman/contrib/sco-wrapper.sh @@ -0,0 +1,6 @@ +# +REALRMAN=/usr/local/bin/rman.real +VOLLISTFILE=/etc/default/man + +VOLLIST=`grep '^ORDER' $VOLLISTFILE | cut -f2 -d=` +exec $REALRMAN -V "=$VOLLIST" $* diff --git a/nx-X11/extras/rman/contrib/sutter.txt b/nx-X11/extras/rman/contrib/sutter.txt new file mode 100644 index 000000000..b467bb348 --- /dev/null +++ b/nx-X11/extras/rman/contrib/sutter.txt @@ -0,0 +1,155 @@ +"Edward L. Sutter" <els@sage.sage.att.com> + +Perhaps there is already a better way to do this, but since I couldn'd find +one, I'd like to make a suggestion that has helped me quite a bit for getting +the proper hypertext links. Keep in mind that this is under the context of +me converting "man" directories with their typical sub-directories of +man1, man2, etc... to an equivalently structured "html" directory with +the same sub-directory heirarchy. + +I added an option to rman that allows it to search for the files over +a specified set of directories. This allows (for example) manpages under +man1 that reference something under man3 to be properly linked. + +rman.c v2.4 ... + +... + +/* ELS: added to support a smarter external reference generator. */ +char *SearchDirs=0; +int HrefSearch(); + +... + +/* ELS: added the -S option: */ + while ((c=getopt(argc,argv,"Kh?f:l:r:bckmTpvn:t:s:yS:"))!=-1) + switch (c) { + case 'k': fHeadfoot=1; break; + case 'b': fSubsections=1; break; + case 'c': fChangeleft=1; break; + case 'S': SearchDirs=optarg; break; + + +... + + +void +HTML(enum command cmd) { + +... + + + case BEGINMANREF: + for (p=hitxt; *p && *p!='('; p++) /* empty */; + *p++='\0'; p0=p; + for (; *p && *p!=')'; p++) /* empty */; + *p='\0'; +/* ELS: added a call to HrefSearch() if the -S option is set.. */ + if (SearchDirs) + HrefSearch(hitxt,p0); + else { + printf("<A HREF=\""); + printf(manRef, hitxt, p0); + printf("\">"); + } + break; + + +... + + +/* ELS... + HrefSearch(): + Active only with command line option -S... + Called when rman -fHTML has determined that it is going to add a + hypertext link. The user tells rman where to search for the hypertext + links (local machine search only) and if HrefSearch() finds the file + + SRCHDIR/manname.section + + where + SRCHDIR is one of the colon-delimited paths specified with + the -S option; + manname is the text that rman found preceding a "manname(##)" + detection; + section is the string within the parens of the manname spec; + + + then it will use that path to build the HREF line. If not found, + then <A> is all that is inserted. + This is generally only helpful when you are simply attempting to + turn a man directory into an html directory. + + Note that if the first char of SearchDirs is a colon, then if + HrefSearch does not find the reference, it defaults to what rman + used to do (use manRef, -r option); otherwise, it will not add + a hypertext link at all. +*/ +HrefSearch(manname,section) +char *manname, *section; +{ + char *dir, *colon, tmp; + int DefaultToManRef; + FILE *fp; + static char path[256]; + + tmp = 0; + +again: + if (SearchDirs[0] == ':') { + dir = &SearchDirs[1]; + DefaultToManRef = 1; + } + else { + dir = SearchDirs; + DefaultToManRef = 0; + } + + /* Make 2 passes on all search directories... */ + /* First pass is with the path dir/manname.section */ + /* Second pass is with the path dir/manname.section[0] */ + /* This allows the spec manname(3x) to be found as manname.3 */ + /* just in cast manname.3x doesn't exist. */ + /* Note that the second pass is only necessary if the section */ + /* string is more than one character in length. */ + while(1) { + colon = strchr(dir,':'); + if (colon) *colon = 0; + sprintf(path,"%s/%s.%s.html",dir,manname,section); + if ((fp = fopen(path,"rw")) != NULL) { + printf("<A HREF=\""); + printf("%s",path); + printf("\">"); + fclose(fp); + if (colon) *colon = ':'; + fprintf(stderr,"HREF @ %s\n",path); + return(1); + } + if (colon) { + *colon = ':'; + dir = colon+1; + } + else + break; + } + if (section[1]) { + tmp = section[1]; + section[1] = 0; + dir = SearchDirs; + goto again; + } + if (tmp) + section[1] = tmp; + + if (DefaultToManRef) { + printf("<A HREF=\""); + printf(manRef, manname, section); + printf("\">"); + } + else + printf("<A>"); + return(1); +} + +/* End ELS additions. */ + diff --git a/nx-X11/extras/rman/contrib/youki.pl b/nx-X11/extras/rman/contrib/youki.pl new file mode 100644 index 000000000..8af5865d6 --- /dev/null +++ b/nx-X11/extras/rman/contrib/youki.pl @@ -0,0 +1,195 @@ +#!/usr/local/bin/perl5 +# +# CGI script for translating manpage into html on the fly. +# Front-end for PolyglotMan (formerly called RosettaMan) +# +# Author: Youki Kadobayashi <youki@center.osaka-u.ac.jp> +# +# NOTE: Replace 'CGI::Apache' with just 'CGI' for systems without mod_perl. +# +# ALSO: You may want to recompile rman like this: +# MANREFPRINTF = "/mod-bin/cgi-rman.pl?keyword=%s§ion=%s" +# + +use CGI::Apache font; # for people with mod_perl and apache +## use CGI font; # for people without mod_perl +$par = "<P>\n"; +$brk = "<BR>\n"; +$bg = '#c0ffff'; + +$query = new CGI::Apache; # for people with mod_perl and apache +## $query = new CGI; # for people without mod_perl + +%mandatory = ('keyword' => 'Name or keyword', + 'section' => 'Manual page section'); + +@given = $query->param; +if ($#given < 0) { + &request_page; + exit 0; +} + +foreach $field (keys %mandatory) { + if ($query->param($field) eq '') { + push(@missing, $mandatory{$field}); + } +} +if ($#missing >= 0) { + &info_missing_page(@missing); +} else { + if ($query->param('type') eq 'apropos') { + &apropos_page; + } else { + &manual_page; + } +} +exit 0; + +sub standout { + my ($level, $color, $string) = @_; + + # As per CGI.pm documentation "Generating new HTML tags" + return $query->font({color => "$color"}, "<$level>$string</$level>"); +} + +sub error_page { + my ($message) = @_; + +# print $query->header, +# $query->start_html(-title=>$message, -BGCOLOR=>$bg); + + print &standout("H2", "brown", $message), + "The above error occured during the manual page generation", + " process. Please check keyword and section number,", + " then try again.", $par; + +# print $query->end_html; +} + +sub info_missing_page { + my (@missing) = @_; + + print $query->header, + $query->start_html(-title=>"Information is missing", + -BGCOLOR=>$bg); + + print &standout("H2", "brown", "Information is missing"), + "Sorry but your request was not fulfilled because", + " the following information is missing in your entry:", $par, + join(' ', @missing), $par, + "Please go back and make sure to enter data on the missing field."; + + print $query->end_html; +} + +sub request_page { + print $query->header, + $query->start_html(-title=>'Hypertext Manual Page', + -author=>'Youki Kadobayashi', + -BGCOLOR=>$bg); + + print &standout("H2", "green", "Hypertext Manual Page"); + + print $query->start_form, + "Type of Search: ", + $query->radio_group(-name=>'type', + -values=>['man', 'apropos'], + -default=>'man'), $brk, + "Name or Keyword: ", + $query->textfield(-name=>'keyword'), $brk, + "Manpage Section: ", + $query->popup_menu(-name=>'section', + -labels=>{ + 0 => 'All Sections', + 1 => '1 - General Commands', + 2 => '2 - System Calls', + 3 => '3 - Library Functions', + 4 => '4 - Device Special Files', + 5 => '5 - File Formats', + 6 => '6 - Games', + 7 => '7 - Macros and Conventions', + 8 => '8 - System Administration', + 'pgsql' => 'PostgreSQL', + 'tcl' => 'Tcl/Tk', + 'mh' => 'Message Handler', + 'isode' => 'ISODE', + 'X11' => 'X Window System'}, + -values=>[0, 1, 2, 3, 4, 5, 6, 7, 8, + 'pgsql', 'tcl', 'mh', + 'isode', 'X11'], + -default=>0), $brk; + + print $query->submit(-name=>'Submit'), $query->reset, + $query->end_form, $par; + + print $query->end_html; +} + +sub manual_page { + my $keyword = $query->param('keyword'); + my $section = $query->param('section'); + my $man = "man"; + my $ok = "-a-zA-Z0-9._"; + + # sanitize for security + $section =~ s/[^$ok]+/_/go; + $keyword =~ s/[^$ok]+/_/go; + + if ($section =~ /^[A-Za-z]/) { + $man .= " -M$section"; + } + elsif ($section =~ /^\d/) { + $section =~ s/^(\d)\w*/\1/go; + $man .= " -s $section"; + } + $man .= ' ' . $keyword; + open (MAN, "$man | /usr/local/bin/rman -f html -n $keyword -s $section |"); + + print $query->header; + # start_html and end_html not needed here, since rman tacks them. + print "<!-- text generated with '$man' by cgi-rman.pl -->\n"; + while (<MAN>) { + print $_; + } + if ($? != 0 || $. < 15) { + &error_page("Your request for manual page '$keyword' failed."); +# print "return code $? line $.\n"; + close(MAN); + return; + } + close(MAN); +} + +sub apropos_page { + my $keyword = $query->param('keyword'); + my $section = $query->param('section'); # igored + my $man = "man -k"; + my $matches = 0; + + $man .= ' ' . $keyword; + open (MAN, "$man |"); + + $url = $query->url; + print $query->header, $query->start_html(-title=>$man); + + while (<MAN>) { + if (/^([a-zA-Z0-9_.-]+)[, ][a-zA-Z0-9_., -]*\((\d)\w*\)/) { + print $`, qq{ <A HREF="$url?keyword=$1§ion=$2&type=man"> }, + $&, "</A>", $'; + ++$matches; + } else { + print $_; + } + print $brk; + } + if ($? != 0 || $matches == 0) { + &error_page("Your search request with keyword '$keyword' failed."); +# print "return code $? matches $matches\n"; + close(MAN); + return; + } + close(MAN); + + print $query->end_html; +} + -- cgit v1.2.3