diff options
Diffstat (limited to 'nx-X11/extras/rman/contrib/bennett.txt')
-rw-r--r-- | nx-X11/extras/rman/contrib/bennett.txt | 371 |
1 files changed, 0 insertions, 371 deletions
diff --git a/nx-X11/extras/rman/contrib/bennett.txt b/nx-X11/extras/rman/contrib/bennett.txt deleted file mode 100644 index 116d74d46..000000000 --- a/nx-X11/extras/rman/contrib/bennett.txt +++ /dev/null @@ -1,371 +0,0 @@ -*** 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" <els@sage.sage.att.com> */ -+ /* AB: HTMLHeader and HTMLFooter by Anne Bennett <anne@alcor.concordia.ca> */ -+ /* AB: SearchDirsPrefix by Anne Bennett <anne@alcor.concordia.ca> */ -+ - /* - 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("<TITLE>"); printf(manTitle, manName, manSect); printf("</TITLE>\n"); - printf("</HEAD>\n<BODY>\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("<A HREF=\"#toc\">%s</A><P>\n", TABLEOFCONTENTS); - I=0; - break; -*************** -*** 1424,1429 **** ---- 1496,1514 ---- - if (lasttoc==BEGINSUBSECTION) printf("</UL>"); - printf("</UL>\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("</BODY></HTML>\n"); - break; - case BEGINBODY: break; -*************** -*** 1500,1510 **** - *p++='\0'; p0=p; - for (; *p && *p!=')'; p++) /* empty */; - *p='\0'; -! if (fmanRef) { printf("<A HREF=\""); printf(manRef, hitxt, p0); printf("\">"); } - else printf("<I>"); - break; - case ENDMANREF: -! if (fmanRef) printf("</A>"); else printf("</I>"); - 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("<A HREF=\""); -! printf(manRef, hitxt, p0); -! printf("\">"); -! } - else printf("<I>"); - break; - case ENDMANREF: -! /* 1996/08/26 Anne Bennett patched */ -! if (fmanRef || SearchDirs) printf("</A>"); else printf("</I>"); - 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", " <ASCII|roff|TkMan|Tk|Ensemble|Sections|HTML|SGML|MIME|LaTeX|LaTeX2e|RTF|pod>" }, - { 'r', 1, "reference:manref:ref", " <man reference printf string>" }, -+ { 'S', 1, "searchdirs", " <man reference search directories>" }, -+ { 'P', 1, "prefix", " <prefix for manpage paths in -S>" }, -+ { 'H', 1, "header", " <HTML header file>" }, -+ { 'F', 1, "footer", " <HTML footer file>" }, - { 'l', 1, "title", " <title printf string>" }, - { '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 - |