home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume10 / manburst.csh < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  3.5 KB

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