Plan 9 from Bell Labs’s /usr/web/sources/contrib/nemo/octopus/man/mkhtmlindex

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
builtin cd $1
echo '<HEAD>'
echo '<TITLE>Octopus User Manual ('$1')</TITLE>'
echo '</HEAD>'
echo '<BODY>'
echo '<B>[<A HREF="/sys/oman/index.html">Index</A>]</B>'
echo -n '<H2>Octopus '
switch($1){
case 1
	echo -n Commands
case 2
	echo -n Functions
case 4
	echo -n File Servers
case O
	echo -n Protocol
}
echo '</H2>'
echo '<HR>'
echo '<DL>'
for (i in [a-z0-9:]*) {
	switch($1/$i){
 	case *
		echo '<DT><A HREF="/magic/oman2html/'$1/$i'">'$i'</A>'
		awk '
		BEGIN { syms = ""; indesc = 0; desc = ""; }
		/.SH *NAME/,/.SH *(DES|SYN)/ {
			if($1 != "\.SH"){
				if($1 ~ /^\..*/)
					i = 2;
				else
					i = 1;
				for(; i <= NF; i++){
					if(indesc){
						desc = desc " " $i;
					} else if($i ~ /^\\?-.*/) {
						indesc = 1;
					} else {
						syms = syms " " $i;
					}
				}
			}
		}
		END { print "- " desc; print "<DD><TT>" syms "</TT>"}
		' $i
		echo '</DT>'
	}
}
echo '</DL>'

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.