[alt.sources] uumerge Patch 1

csu@alembic.acs.com (Dave Mack) (06/11/90)

Apparently some versions of uudecode are too stupid to ignore
anything in a file preceding a "begin" line, so when a single
file is fed to uumerge, it will fail. This patch corrects the
problem.

Feed this article to patch in the appropriate directory or make
the changes by hand.

	patch -d <directory-where-uumerge-lives> < patch1

-------------------------------- cut here --------------------------------
*** uumerge1	Mon Jun 11 02:07:55 1990
--- uumerge	Mon Jun 11 02:18:07 1990
***************
*** 35,54 ****
  # If the last chunk only contains the last two or three lines of
  # the uuencoded file (the ones that don't start with "M"), uumerge
  # will die.
! 
  if ($#ARGV < 0 ) {
  	print "Usage: uumerge filename [filename...]\n";
  	exit 1;
  }
  
  # if we only have one file, pump it straight into uudecode and die
  if ( $#ARGV == 0 ) {
! 	system("cat $ARGV[0] | uudecode");
  	exit 0;
  }
- $| = 1;
- # open a pipe into uudecode
- open(DECO,"|uudecode") || die "Can't pipe into uudecode\n";
  
  # process the first file - make sure we have a "begin" line
  
--- 35,83 ----
  # If the last chunk only contains the last two or three lines of
  # the uuencoded file (the ones that don't start with "M"), uumerge
  # will die.
! #
! # CHANGES
! #
! # PATCH 1:
! # It appears that some versions of uudecode are too stupid to skip
! # past the lines preceding the "begin" line, so feeding a one-part
! # uuencoded file to uumerge will bomb.
! #
  if ($#ARGV < 0 ) {
  	print "Usage: uumerge filename [filename...]\n";
  	exit 1;
  }
  
+ $| = 1;
+ # open a pipe into uudecode
+ open(DECO,"|uudecode") || die "Can't pipe into uudecode\n";
+ 
  # if we only have one file, pump it straight into uudecode and die
  if ( $#ARGV == 0 ) {
! 	open(FIRST,"<$ARGV[0]") || die "Can't open $ARGV[0] for input\n";
! 
! 	while ( <FIRST> ) {
! 		# skip past everything before the "begin" line
! 		next unless /^begin [0-9]/;
! 		last;
! 	}
! 	die "$ARGV[0] doesn't contain \"begin\"\n" if eof(FIRST);
! 	
! 	print DECO $_; # the begin line
! 
! 	while ( <FIRST> ) {
! 		print DECO $_ unless /^end/;
! 		if ( /^end/ ) {
! 			print DECO $_;
! 			last;
! 		}
! 		die "$ARGV[0] doesn't contain \"end\"\n" if eof(FIRST);
! 	}
! 
! 	# done with file
! 	close(FIRST);
  	exit 0;
  }
  
  # process the first file - make sure we have a "begin" line