html-man 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. eval 'exec perl -Ssw $0 "$@"'
  2. if 0;
  3. # Take a man tree and make an html tree out of it
  4. #
  5. # Derived from Donners man2html script
  6. from=/usr/man
  7. to=/u/eo/repository/system/unix/man
  8. function disambiguate
  9. {
  10. newbase=${1}
  11. newname="${newbase}.1"
  12. dis=2
  13. while [ -a "${newname}" ]
  14. do
  15. newname=$newbase"."$dis
  16. dis=$(expr $dis + 1)
  17. done
  18. }
  19. while ($ARGV[0] =~ /^-/) {
  20. if ($ARGV[0] eq "-f") {
  21. shift(@ARGV);
  22. $from = shift(@ARGV);
  23. }
  24. if ($ARGV[0] eq "-t") {
  25. shift(@ARGV);
  26. $to = shift(@ARGV);
  27. }
  28. }
  29. open(FD, "find $from -name '*.[0-9ln]' -print |");
  30. while ($find = <FD>) {
  31. }
  32. if [ ! "${indexonly}" ]
  33. then
  34. print "Processing the man pages ..."
  35. for i in man${sections}/*
  36. do
  37. if [ "$verbose" ]
  38. then
  39. print $i
  40. fi
  41. # n=${i%.*}
  42. name=${to}/${i}
  43. if [ -a "${name}" ]
  44. then
  45. oldname=$name
  46. disambiguate $name
  47. name=$newname
  48. print "Collision - ${oldname} will be stored as ${name}"
  49. fi
  50. eqn $i | tbl | nroff -man | rman -f HTML | sed -e "s/MS_LOCAL_HOST/${localeo}/g" > ${name}
  51. done
  52. fi
  53. print "Building the index.html files ..."
  54. cd $to
  55. for i in man${sections}
  56. do
  57. if [ "$verbose" ]
  58. then
  59. print $i
  60. fi
  61. cd $i
  62. rm -f index.html
  63. echo '<ul>' > ../new.html
  64. for j in *
  65. do
  66. if [ "$verbose" ]
  67. then
  68. print -n "$j "
  69. fi
  70. print
  71. print "<li> <a href=$j>$j</a>" >> ../new.html
  72. done
  73. echo '</ul>' >> ../new.html
  74. mv ../new.html index.html
  75. cd ..
  76. done