home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1444 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  2.5 KB

  1. From: csu@alembic.acs.com (Dave Mack)
  2. Newsgroups: alt.sex.pictures,alt.sources,comp.lang.perl
  3. Subject: uumerge Patch 1
  4. Message-ID: <1990Jun11.063158.6360@alembic.acs.com>
  5. Date: 11 Jun 90 06:31:58 GMT
  6.  
  7. Apparently some versions of uudecode are too stupid to ignore
  8. anything in a file preceding a "begin" line, so when a single
  9. file is fed to uumerge, it will fail. This patch corrects the
  10. problem.
  11.  
  12. Feed this article to patch in the appropriate directory or make
  13. the changes by hand.
  14.  
  15.     patch -d <directory-where-uumerge-lives> < patch1
  16.  
  17. -------------------------------- cut here --------------------------------
  18. *** uumerge1    Mon Jun 11 02:07:55 1990
  19. --- uumerge    Mon Jun 11 02:18:07 1990
  20. ***************
  21. *** 35,54 ****
  22.   # If the last chunk only contains the last two or three lines of
  23.   # the uuencoded file (the ones that don't start with "M"), uumerge
  24.   # will die.
  25.   if ($#ARGV < 0 ) {
  26.       print "Usage: uumerge filename [filename...]\n";
  27.       exit 1;
  28.   }
  29.   
  30.   # if we only have one file, pump it straight into uudecode and die
  31.   if ( $#ARGV == 0 ) {
  32. !     system("cat $ARGV[0] | uudecode");
  33.       exit 0;
  34.   }
  35. - $| = 1;
  36. - # open a pipe into uudecode
  37. - open(DECO,"|uudecode") || die "Can't pipe into uudecode\n";
  38.   
  39.   # process the first file - make sure we have a "begin" line
  40.   
  41. --- 35,83 ----
  42.   # If the last chunk only contains the last two or three lines of
  43.   # the uuencoded file (the ones that don't start with "M"), uumerge
  44.   # will die.
  45. ! #
  46. ! # CHANGES
  47. ! #
  48. ! # PATCH 1:
  49. ! # It appears that some versions of uudecode are too stupid to skip
  50. ! # past the lines preceding the "begin" line, so feeding a one-part
  51. ! # uuencoded file to uumerge will bomb.
  52. ! #
  53.   if ($#ARGV < 0 ) {
  54.       print "Usage: uumerge filename [filename...]\n";
  55.       exit 1;
  56.   }
  57.   
  58. + $| = 1;
  59. + # open a pipe into uudecode
  60. + open(DECO,"|uudecode") || die "Can't pipe into uudecode\n";
  61.   # if we only have one file, pump it straight into uudecode and die
  62.   if ( $#ARGV == 0 ) {
  63. !     open(FIRST,"<$ARGV[0]") || die "Can't open $ARGV[0] for input\n";
  64. !     while ( <FIRST> ) {
  65. !         # skip past everything before the "begin" line
  66. !         next unless /^begin [0-9]/;
  67. !         last;
  68. !     }
  69. !     die "$ARGV[0] doesn't contain \"begin\"\n" if eof(FIRST);
  70. !     
  71. !     print DECO $_; # the begin line
  72. !     while ( <FIRST> ) {
  73. !         print DECO $_ unless /^end/;
  74. !         if ( /^end/ ) {
  75. !             print DECO $_;
  76. !             last;
  77. !         }
  78. !         die "$ARGV[0] doesn't contain \"end\"\n" if eof(FIRST);
  79. !     }
  80. !     # done with file
  81. !     close(FIRST);
  82.       exit 0;
  83.   }
  84.   
  85.   # process the first file - make sure we have a "begin" line
  86.   
  87.