diff options
author | Reinhard Tartler <siretart@tauware.de> | 2011-10-10 17:43:39 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2011-10-10 17:43:39 +0200 |
commit | f4092abdf94af6a99aff944d6264bc1284e8bdd4 (patch) | |
tree | 2ac1c9cc16ceb93edb2c4382c088dac5aeafdf0f /nx-X11/extras/rman/contrib/sutter.txt | |
parent | a840692edc9c6d19cd7c057f68e39c7d95eb767d (diff) | |
download | nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.tar.gz nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.tar.bz2 nx-libs-f4092abdf94af6a99aff944d6264bc1284e8bdd4.zip |
Imported nx-X11-3.1.0-1.tar.gznx-X11/3.1.0-1
Summary: Imported nx-X11-3.1.0-1.tar.gz
Keywords:
Imported nx-X11-3.1.0-1.tar.gz
into Git repository
Diffstat (limited to 'nx-X11/extras/rman/contrib/sutter.txt')
-rw-r--r-- | nx-X11/extras/rman/contrib/sutter.txt | 155 |
1 files changed, 155 insertions, 0 deletions
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. */ + |