home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume10 / man_burst.csh < prev    next >
Encoding:
Text File  |  1990-02-13  |  3.2 KB  |  101 lines

  1. Newsgroups: comp.sources.misc
  2. organization: Packaging/Interconnect, M.C.C.
  3. keywords: X11, man, man_burst
  4. summary: (intended for use with the X11R4 man pages and similar situations.)
  5. subject: v10i063: man_burst, csh script to expand multi-name mans via .so references
  6. From: news@cs.utexas.edu.uucp@@uunet.uu.net:emx.utexas.edu
  7. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  8.  
  9. Posting-number: Volume 10, Issue 63
  10. Submitted-by: news@cs.utexas.edu.uucp@@uunet.uu.net:emx.utexas.edu
  11. Archive-name: man_burst.csh
  12.  
  13. #! /bin/sh
  14. # This file was wrapped with "dummyshar".  "sh" this file to extract.
  15. # Contents:  man_burst.csh
  16. echo extracting 'man_burst.csh'
  17. if test -f 'man_burst.csh' -a -z "$1"; then echo Not overwriting 'man_burst.csh'; else
  18. sed 's/^X//' << \EOF > 'man_burst.csh'
  19. X#! /bin/csh -fb
  20. X#    shellscript "man_burst", 25.1.1990, unsupported.
  21. X#    Christopher North-Keys (harp@mcc.com <or> erlkonig@ccwf.cc.utexas.edu)
  22. X#
  23. X#    expand multi-name man pages by adding .so references within the man dir
  24. X#    so that man(1) can find man pages discussing multiple commands.
  25. X#    (intended for use with the X11R4 man pages and similar situations.)
  26. X#
  27. X#    run within the directory in which the man pages are to be "burst",
  28. X#    then you will probably have to run makewhatis or catman.
  29. X#    test in verbose/no-write mode by running with -w.
  30. X
  31. Xif ($#argv > 0) then
  32. X    if ("$argv[1]" == "-w") then
  33. X        set nowrite
  34. X        echo '--------------------NOWRITE mode set (will not write)'
  35. X    endif
  36. Xendif
  37. X
  38. Xset failures = 0
  39. X
  40. Xecho $cwd:h | grep -s man\$ ; @ failures += $status
  41. Xecho $cwd:t | grep -s man   ; @ failures += $status
  42. X
  43. Xif ($failures) then
  44. X    echo -n $cwd' may not be a directory of manual pages; continue? '
  45. X    if ("$<" != "y") exit 1
  46. Xendif
  47. X
  48. Xset section = `echo $cwd:t | cut -c4-`
  49. Xset length
  50. X
  51. Xforeach file (*)
  52. X    echo Checking $file
  53. X
  54. X    # attempt to insure that $file is a [nt]roff/tbl/eqn man sourcefile
  55. X    file $file | grep -s 'roff'
  56. X    if ($status) then
  57. X        head -1 $file | grep -s '\.so'
  58. X        if !($status) then
  59. X            echo $file refers to another manual page.
  60. X            continue
  61. X        endif
  62. X        echo $file' does not appear to be a manual page; skipping.'
  63. X        continue
  64. X    endif
  65. X
  66. X    set startline = `egrep -n ".SH NAME" $file | cut -d: -f1`
  67. X    @ startline ++
  68. X    set endline = `egrep -n ".SH SYNTAX"\|".SH STRUCTURES" $file | cut -d: -f1`
  69. X    @ length = $endline - $startline
  70. X    set names = `tail +${startline} $file | head -${length} | tr -d "," `
  71. X
  72. X    set suffix = $file:e    
  73. X    foreach name ($names)
  74. X        set target = ${name}.$suffix
  75. X
  76. X        if (("$name" == "\-") || ("$name" == "\")) break
  77. X
  78. X        echo "         "${name}
  79. X        if (-e $target) then
  80. X            echo already exists as $target
  81. X            continue
  82. X        endif
  83. X
  84. X        if ($?nowrite) then
  85. X            echo "echo .so man${section}/${file} > $target"
  86. X        else
  87. X            echo ".so man${section}/${file}" > $target
  88. X        endif
  89. X    end
  90. Xend
  91. EOF
  92. chars=`wc -c < 'man_burst.csh'`
  93. if test $chars !=     1961; then echo 'man_burst.csh' is $chars characters, should be     1961 characters!; fi
  94. fi
  95. exit 0
  96.  
  97. ------------------------------------/\----------------------------------------
  98. Seo:  Harp[@Mcc.Com]               /  \/\ ^*^           Christopher North-Keys
  99. Tha mi gu trang a'cluich.         /    \ \         Assoc. Systems Analyst, MCC
  100. --------------------------------(disclaimer)----------------------------------
  101.