home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume26 / kit / pch19 < prev    next >
Encoding:
Text File  |  1993-05-04  |  9.3 KB  |  356 lines

  1. Newsgroups: comp.sources.unix
  2. From: ram@acri.fr (Raphael Manfredi)
  3. Subject: v26i224: kit - the ultimate mailing kit, Patch19
  4. Sender: unix-sources-moderator@efficacy.home.vix.com
  5. Approved: WhoAmI@efficacy.home.vix.com
  6.  
  7. Submitted-By: ram@acri.fr (Raphael Manfredi)
  8. Posting-Number: Volume 26, Issue 224
  9. Archive-Name: kit/pch19
  10.  
  11. [The latest patch for kit version 2.0 is #28.]
  12.  
  13. System: kit version 2.0
  14. Patch #: 19
  15. Priority: LOW
  16. Subject: forgot the 'range' target in kit's Makefile
  17. Subject: unkit will use perl instead of awk, if available
  18. Subject: now smart enough to deal with multiple parts from stdin
  19. Subject: now recognizes - as being stdin
  20. Date: Fri Sep  4 19:28:39 PDT 1992
  21. From: Raphael Manfredi <ram@eiffel.com>
  22.  
  23. Description:
  24.     Forgot the 'range' target in the Makefile.SH held in the kit
  25.     subdirectory. Configure normally automatically extracts the
  26.     .SH files, but when you want to rebuild the kit subdirectory,
  27.     it's nice to have range rebuild when it changes...
  28.  
  29.     Unkit will use perl instead of awk, if available. This is because
  30.     awk is really dumb and will not let you open more than 10 or 15
  31.     files. If you put more than that amount of kits in a single file,
  32.     they would not be extracted correctly by awk, but of course perl
  33.     does not suffer the same limitation. The awk code has been kept,
  34.     as perl is not a standard yet.
  35.  
  36.     Also, kit is now smart enough to deal with multiple parts from
  37.     stdin, which is really neat when processing multiple kits parts
  38.     from a mail user agent. For instance, under MH, you can say
  39.  
  40.         show 6-10 | unkit
  41.     
  42.     to unkit messages 6 through 10. There was a silent limitation
  43.     which existed before this patch, where the number of parts coming
  44.     from stdin was limited to 1.
  45.  
  46.     As a side effect, unkit now recognizes - as meaing stdin on the
  47.     command line. That is to say,
  48.  
  49.         unkit foo bar -
  50.     
  51.     would start unkit'ing messages from the two files foo and bar and
  52.     then wait for more input on stdin.
  53.  
  54.  
  55. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your kit source
  56.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  57.     If you don't have the patch program, apply the following by hand,
  58.     or get patch (version 2.0, latest patchlevel).
  59.  
  60.     After patching:
  61.         Configure -d
  62.         make
  63.         make install
  64.  
  65.     If patch indicates that patchlevel is the wrong version, you may need
  66.     to apply one or more previous patches, or the patch may already
  67.     have been applied.  See the patchlevel.h file to find out what has or
  68.     has not been applied.  In any event, don't continue with the patch.
  69.  
  70.     If you are missing previous patches they can be obtained from me:
  71.  
  72.         Raphael Manfredi <ram@eiffel.com>
  73.  
  74.     If you send a mail message of the following form it will greatly speed
  75.     processing:
  76.  
  77.         Subject: Command
  78.         @SH mailpatch PATH kit 2.0 LIST
  79.                ^ note the c
  80.  
  81.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  82.     or in bang notation from some well-known host, and LIST is the number
  83.     of one or more patches you need, separated by spaces, commas, and/or
  84.     hyphens.  Saying 35- says everything from 35 to the end.
  85.  
  86.     To get some more detailed instructions, send me the following mail:
  87.  
  88.         Subject: Command
  89.         @SH mailhelp PATH
  90.  
  91.  
  92. Index: patchlevel.h
  93. Prereq: 18
  94. 2c2
  95. < #define PATCHLEVEL 18
  96. ---
  97. > #define PATCHLEVEL 19
  98.  
  99. Index: kit/unkit.SH
  100. Prereq: 2.0.1.11
  101. *** kit/unkit.SH.old    Fri Sep  4 19:28:36 1992
  102. --- kit/unkit.SH    Fri Sep  4 19:28:37 1992
  103. ***************
  104. *** 19,27 ****
  105.   # @(#) (c) E. Mogenet April 1990
  106.   # @(#) (c) R. Manfredi, 1990 1991
  107.   
  108. ! # $Id: unkit.SH,v 2.0.1.11 92/08/17 17:59:42 ram Exp $
  109.   #
  110.   # $Log:    unkit.SH,v $
  111.   # Revision 2.0.1.11  92/08/17  17:59:42  ram
  112.   # patch18: new -k option, added by Steve Tynor <fugue!tynor@gatech.edu>
  113.   # patch18: do not start unkiting until all parts are here (Jaap Vermulen)
  114. --- 19,32 ----
  115.   # @(#) (c) E. Mogenet April 1990
  116.   # @(#) (c) R. Manfredi, 1990 1991
  117.   
  118. ! # $Id: unkit.SH,v 2.0.1.12 92/09/04 19:28:28 ram Exp $
  119.   #
  120.   # $Log:    unkit.SH,v $
  121. + # Revision 2.0.1.12  92/09/04  19:28:28  ram
  122. + # patch19: unkit will use perl instead of awk, if available
  123. + # patch19: now smart enough to deal with multiple parts from stdin
  124. + # patch19: now recognizes - as being stdin
  125. + # 
  126.   # Revision 2.0.1.11  92/08/17  17:59:42  ram
  127.   # patch18: new -k option, added by Steve Tynor <fugue!tynor@gatech.edu>
  128.   # patch18: do not start unkiting until all parts are here (Jaap Vermulen)
  129. ***************
  130. *** 171,186 ****
  131.   # If no file name is given, process the standard input
  132.   if test $# -eq 0
  133.   then
  134. !     eval $unshar_cmd
  135. ! else
  136. !     # More than one kit part can be held in the files given as argument.
  137. !     # Loop over each of the supplied arguments and extract parts based on
  138. !     # the leading #!/bin/sh put by the shell archiver.
  139. !     list=''
  140. !     count=0
  141.   
  142. !     for file in $*; do
  143.           num=`awk '
  144.           BEGIN { a = 0; file = "zag.tmp" }
  145.           /^#![     ]*\/bin\/sh/ {
  146. --- 176,210 ----
  147.   # If no file name is given, process the standard input
  148.   if test $# -eq 0
  149.   then
  150. !     set X -
  151. !     shift
  152. ! fi
  153.   
  154. ! # More than one kit part can be held in the files given as argument.
  155. ! # Loop over each of the supplied arguments and extract parts based on
  156. ! # the leading #!/bin/sh put by the shell archiver.
  157. ! list=''
  158. ! count=0
  159. ! for file in $*; do
  160. !     # Use perl if possible, as it does not have this stupid awk limitation
  161. !     # about the maximum number of opened files. However, I want this to
  162. !     # run (barely) even if perl is not available.
  163. !     if (perl -v) >/dev/null 2>&1; then
  164. !         num=`perl -e '
  165. !         $a = 0;
  166. !         open(FILE, ">>zag.tmp");
  167. !         while (<>) {
  168. !             if (m|^#!\s*/bin/sh|) {
  169. !                 $a++;
  170. !                 open(FILE, ">zag.tmp.$a");
  171. !             }
  172. !             print FILE;
  173. !         }
  174. !         print "$a\n";
  175. !         ' $file`
  176. !     else
  177.           num=`awk '
  178.           BEGIN { a = 0; file = "zag.tmp" }
  179.           /^#![     ]*\/bin\/sh/ {
  180. ***************
  181. *** 192,247 ****
  182.           { print >> file }
  183.           END { printf("%d\n", a) }
  184.           ' $file`
  185. !         name=''
  186. !         case "$num" in
  187. !         0)
  188. !             rm -f zag.tmp
  189. !             echo "unkit: warning: no kit part in $file (skipped)." >&2
  190.               ;;
  191. !         1)
  192.               rm -f zag.tmp.1
  193.               echo "unkit: one kit part found in $file."
  194.               name=$file
  195.               ;;
  196. -         *)
  197. -             echo "unkit: $num kit parts found in $file." >&2
  198. -             # Each part is renamed into a zag.xtr.* file to free the name
  199. -             # space for the next file (each awk extracts into zag.tmp.*).
  200. -             for part in zag.tmp.*; do
  201. -                 count=`expr $count + 1`
  202. -                 new="zag.xtr.$count"
  203. -                 mv $part $new
  204. -                 name="$name $new"
  205. -             done
  206. -             ;;
  207.           esac
  208. !         list="$list $name"
  209. !     done
  210. !     set X $list
  211. !     shift
  212. !     case $# in
  213. !     1) ;;
  214.       *)
  215. !         case "$count" in
  216. !         0)
  217. !             echo "unkit: found a total of $# kit parts." >&2;;
  218. !         *)
  219. !             echo "unkit: found $# kit parts ($count parts extracted)." >&2;;
  220.           esac
  221.           ;;
  222.       esac
  223.   
  224. !     # Loop over each identified kir part and unshar it
  225. !     for i
  226. !     do
  227. !         # The command expects "$a" to be the parameter
  228. !         eval "a=$i; $unshar_cmd"    &&
  229. !         (test $preserve = no && rm $i)
  230. !     done
  231.   
  232. !     # Clean up extracted parts (save disk space before tar extraction)
  233. !     rm -f zag.[tx][mt]*
  234. ! fi
  235.   
  236.   # Now check for file names to find how to decode
  237.   if test -f z[ace][gbc].ba.aa -a ! -f ark*isdone
  238. --- 216,286 ----
  239.           { print >> file }
  240.           END { printf("%d\n", a) }
  241.           ' $file`
  242. !     fi
  243. !     name=''
  244. !     case "$num" in
  245. !     0)
  246. !         case "$file" in
  247. !         -) file='stdin';;
  248. !         esac
  249. !         echo "unkit: warning: no kit part in $file (skipped)." >&2
  250. !         rm -f zag.tmp
  251. !         ;;
  252. !     1)
  253. !         case "$file" in
  254. !         -)
  255. !             echo "unkit: one kit part found in stdin."
  256. !             name=zag.tmp.1
  257.               ;;
  258. !         *)
  259.               rm -f zag.tmp.1
  260.               echo "unkit: one kit part found in $file."
  261.               name=$file
  262.               ;;
  263.           esac
  264. !         ;;
  265.       *)
  266. !         case "$file" in
  267. !         -) file='stdin';;
  268.           esac
  269. +         echo "unkit: $num kit parts found in $file." >&2
  270. +         # Each part is renamed into a zag.xtr.* file to free the name
  271. +         # space for the next file (each awk extracts into zag.tmp.*).
  272. +         for part in zag.tmp.*; do
  273. +             count=`expr $count + 1`
  274. +             new="zag.xtr.$count"
  275. +             mv $part $new
  276. +             name="$name $new"
  277. +         done
  278.           ;;
  279.       esac
  280. +     list="$list $name"
  281. + done
  282. + set X $list
  283. + shift
  284. + case $# in
  285. + 1) ;;
  286. + *)
  287. +     case "$count" in
  288. +     0)
  289. +         echo "unkit: found a total of $# kit parts." >&2;;
  290. +     *)
  291. +         echo "unkit: found $# kit parts ($count parts extracted)." >&2;;
  292. +     esac
  293. +     ;;
  294. + esac
  295.   
  296. ! # Loop over each identified kit part and unshar it
  297. ! for i
  298. ! do
  299. !     # The command expects "$a" to be the parameter.
  300. !     eval "a=$i; $unshar_cmd"    &&
  301. !     (test $preserve = no && rm $i)
  302. ! done
  303.   
  304. ! # Clean up extracted parts (save disk space before tar extraction)
  305. ! rm -f zag.[tx][mt]*
  306.   
  307.   # Now check for file names to find how to decode
  308.   if test -f z[ace][gbc].ba.aa -a ! -f ark*isdone
  309.  
  310. Index: kit/Makefile.SH
  311. Prereq: 2.0.1.5
  312. *** kit/Makefile.SH.old    Fri Sep  4 19:28:32 1992
  313. --- kit/Makefile.SH    Fri Sep  4 19:28:32 1992
  314. ***************
  315. *** 18,26 ****
  316.   # Makefile for kit (sub-directory kit)
  317.   #
  318.   
  319. ! # $Id: Makefile.SH,v 2.0.1.5 92/05/02 14:13:13 ram Exp $
  320.   #
  321.   # $Log:    Makefile.SH,v $
  322.   # Revision 2.0.1.5  92/05/02  14:13:13  ram
  323.   # patch16: added rules for new range script
  324.   # 
  325. --- 18,29 ----
  326.   # Makefile for kit (sub-directory kit)
  327.   #
  328.   
  329. ! # $Id: Makefile.SH,v 2.0.1.6 92/09/04 19:22:28 ram Exp $
  330.   #
  331.   # $Log:    Makefile.SH,v $
  332. + # Revision 2.0.1.6  92/09/04  19:22:28  ram
  333. + # patch19: forgot the 'range' target
  334. + # 
  335.   # Revision 2.0.1.5  92/05/02  14:13:13  ram
  336.   # patch16: added rules for new range script
  337.   # 
  338. ***************
  339. *** 67,72 ****
  340. --- 70,78 ----
  341.       sh $@.SH
  342.   
  343.   minikit: minikit.SH
  344. +     sh $@.SH
  345. + range: range.SH
  346.       sh $@.SH
  347.   
  348.   install: $(scripts)
  349.  
  350. *** End of Patch 19 ***
  351.