mkhtmlindex 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/rc
  2. builtin cd $1
  3. echo '<HEAD>'
  4. echo '<TITLE>plan 9 man section '$1'</TITLE>'
  5. echo '</HEAD>'
  6. echo '<BODY>'
  7. echo '<B>[<A HREF="/sys/man/index.html">manual index</A>]</B>'
  8. echo -n '<H2>Plan 9 from Bell Labs - Section '$1' - '
  9. switch($1){
  10. case 1
  11. echo -n Commands
  12. case 2
  13. echo -n System and Library Calls
  14. case 3
  15. echo -n Devices
  16. case 4
  17. echo -n File Servers
  18. case 5
  19. echo -n Plan 9 File Protocol, 9P
  20. case 6
  21. echo -n File Formats, Misc
  22. case 7
  23. echo -n Databases
  24. case 8
  25. echo -n System Administration
  26. }
  27. echo '</H2>'
  28. echo '<HR>'
  29. echo '<DL>'
  30. for (i in [a-z0-9:]*) {
  31. switch($1/$i){
  32. case 1/ap 1/aviation 1/distill 1/dup 1/games 1/lml 1/noweb 1/pac
  33. case 2/button 2/fmenu 2/ftree
  34. case 6/noweb
  35. case 7/audio 7/chdb 7/music 7/road
  36. ;
  37. case *
  38. echo '<DT><A HREF="/magic/man2html/'$1/$i'">'$i'</A>'
  39. awk '
  40. BEGIN { syms = ""; indesc = 0; desc = ""; }
  41. /.SH *NAME/,/.SH *(DES|SYN)/ {
  42. if($1 != "\.SH"){
  43. if($1 ~ /^\..*/)
  44. i = 2;
  45. else
  46. i = 1;
  47. for(; i <= NF; i++){
  48. if(indesc){
  49. desc = desc " " $i;
  50. } else if($i ~ /^\\?-.*/) {
  51. indesc = 1;
  52. } else {
  53. syms = syms " " $i;
  54. }
  55. }
  56. }
  57. }
  58. END { print "- " desc; print "<DD><TT>" syms "</TT>"}
  59. ' $i
  60. echo '</DT>'
  61. }
  62. }
  63. echo '</DL>'