63 lines · 1.2 KB · Text
RawDownload
#!/bin/rcbuiltin cd $1echo '<HEAD>'echo '<TITLE>plan 9 man section '$1'</TITLE>'echo '</HEAD>'echo '<BODY>'echo '<B>[<A HREF="/sys/man/index.html">manual index</A>]</B>'echo -n '<H2>Plan 9 from Bell Labs - Section '$1' - 'switch($1){case 1	echo -n Commandscase 2	echo -n System and Library Callscase 3	echo -n Devicescase 4	echo -n File Serverscase 5	echo -n Plan 9 File Protocol, 9Pcase 6	echo -n File Formats, Misccase 7	echo -n Databasescase 8	echo -n System Administration}echo '</H2>'echo '<HR>'echo '<DL>'for (i in [a-z0-9:]*) {	switch($1/$i){	case 1/ap 1/aviation 1/distill 1/dup 1/games 1/lml 1/noweb 1/pac	case 2/button 2/fmenu 2/ftree	case 6/noweb	case 7/audio 7/chdb 7/music 7/road		; 	case *		echo '<DT><A HREF="/magic/man2html/'$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>'