ref: d4bc9052beb3305d64a353a16641740380eb87af
dir: /sys/lib/man/mkhtmlindex/
#!/bin/rc builtin cd $1 echo '<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 Commands case 2 echo -n System and Library Calls case 3 echo -n Devices case 4 echo -n File Servers case 5 echo -n Plan 9 File Protocol, 9P case 6 echo -n File Formats, Misc case 7 echo -n Databases case 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>'