home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / aux / 3249 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.5 KB  |  84 lines

  1. Newsgroups: comp.unix.aux
  2. Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!news.udel.edu!me.udel.edu!johnston
  3. From: johnston@me.udel.edu (Bill Johnston)
  4. Subject: Shell script for installing man pages (was: man's problems)
  5. Message-ID: <Btnu40.JyL@news.udel.edu>
  6. Sender: usenet@news.udel.edu
  7. Nntp-Posting-Host: me.udel.edu
  8. Organization: University of Delaware
  9. References: <1992Aug23.231247.6667@sunova.ssc.gov>
  10. Date: Thu, 27 Aug 1992 20:55:11 GMT
  11. Lines: 71
  12.  
  13. In article <1992Aug23.231247.6667@sunova.ssc.gov> 
  14. ww2@bullwinkle.ssc.gov (Wes Price) writes:
  15.  
  16. >More specifically, is there anything that can cope with A/UX's curious
  17. >/usr/catman hierarchy, and with the fact that there is no nroff source
  18. >for any of those man pages, and with the fact that there may be alternate
  19. >man-directory hierarchies which will have nroffable (i.e., not preformatted)
  20. >man pages?
  21.  
  22. Here is a shell script by Bob Denny that I found in the archives on
  23. aux.support.apple.com.  It makes installing aux-ready man pages
  24. from nroff source fairly painless.  To use, copy to /usr/local/bin
  25. and chmod 755 (or similar) to make the file executable.
  26.  
  27. #!/bin/sh
  28. # @(#) auxman - format, pack and install manpages on A/UX
  29. #
  30. # Bob Denny - Sun Sep 15 15:13:12 1991
  31. # If man-page ends in ".z" then pack(1) is used to compress the
  32. # man page text prior to moving it to the final location. If pack
  33. # fails, the page is installed without the ".z" suffix. Any pre-existing
  34. # man page is explicitly removed (with or without the ".z") in case it
  35. # was linked to another page, or had another page linked to it. 
  36. #
  37. # NOTE: The "lp" terminal type is used, and sed(1) is used to remove
  38. # the backspace-bolding stuff from nroff's output (it causes premature
  39. # word-wrapping).
  40. #
  41. if [ $# -ne 2 ] ; then
  42.     echo "Incorrect argument count."
  43.     echo "Usage: auxman nroff-src man-page"
  44.     echo "       man-page must be full pathname to location at which to"
  45.     echo "       install the man page."
  46.     exit 1
  47. fi
  48.  
  49. dest=$2
  50. destnoz=`echo $2 | sed 's/\(.*\)\.z$/\1/`
  51.  
  52. if [ -f $dest ] ; then
  53.     rm -f $dest
  54. fi
  55.  
  56. if [ -f $destnoz ] ; then
  57.     rm -f $destnoz
  58. fi
  59.  
  60. nroff -Tlp -man $1 |  sed -e 's/\([A-Za-z]\).\1.\1.\1/\1/g' > %TMP%$$
  61.  
  62. if [ `echo $dest | grep '\.z$'` ] ; then
  63.     pack %TMP%$$ 1>/dev/null 2>&1
  64.     if [ $? -eq 0 ] ; then
  65.         mv %TMP%$$.z $dest || cp %TMP%$$.z $dest
  66.     else
  67.         dest=$destnoz    # <==== NOTE!
  68.         cp %TMP%$$ $dest
  69.     fi
  70. else
  71.     mv %TMP%$$ $dest || cp %TMP%$$  $dest
  72. fi
  73.  
  74. rm -f %TMP%*
  75. chgrp bin $dest
  76. chown bin $dest
  77. chmod 0644 $dest
  78. exit 0
  79.  
  80. -- 
  81. -- Bill Johnston (johnston@me.udel.edu)
  82. -- 38 Chambers Street; Newark, DE 19711; (302)368-1949
  83.