mkhtmlindex 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. case 9
  27. echo -n Kernel Functions
  28. }
  29. echo '</H2>'
  30. echo '<HR>'
  31. echo '<DL>'
  32. for (i in [a-z0-9:]*) {
  33. switch($1/$i){
  34. case 1/ap 1/aviation 1/distill 1/dup 1/games 1/lml 1/noweb 1/pac
  35. case 2/button 2/fmenu 2/ftree
  36. case 6/noweb
  37. case 7/audio 7/chdb 7/music 7/road
  38. ;
  39. case *
  40. echo '<DT><A HREF="/magic/man2html/'$1/$i'">'$i'</A>'
  41. awk '
  42. BEGIN { syms = ""; indesc = 0; desc = ""; }
  43. /.SH *NAME/,/.SH *(DES|SYN)/ {
  44. if($1 != "\.SH"){
  45. if($1 ~ /^\..*/)
  46. i = 2;
  47. else
  48. i = 1;
  49. for(; i <= NF; i++){
  50. if(indesc){
  51. desc = desc " " $i;
  52. } else if($i ~ /^\\?-.*/) {
  53. indesc = 1;
  54. } else {
  55. syms = syms " " $i;
  56. }
  57. }
  58. }
  59. }
  60. END { print "- " desc; print "<DD><TT>" syms "</TT>"}
  61. ' $i
  62. echo '</DT>'
  63. }
  64. }
  65. echo '</DL>'