Subj : text_compare To : Digital Man From : Angus Mcleod Date : Sun Feb 06 2005 12:02 pm Re: text_compare By: Digital Man to Angus Mcleod on Thu Feb 03 2005 12:31:00 > > Can't help but feel I'm forgetting to do something..... > > Looks like it won't handle lines added to the bottom of text.dat.NEW. Here's an updated main loop that should take care of it. I hope. --------8<----------------- while (((!$ori->eof()) && (!$mod->eof())) || (!$upd->eof())) { ($oraw, $otext) = read_text( $ori ) unless $ori->eof(); ($mraw, $mtext) = read_text( $mod ) unless $mod->eof(); ($uraw, $utext) = read_text( $upd ) unless $upd->eof(); if ($ori->eof() && $mod->eof() && (!$upd->eof())) { # updated file contains extra texts print @$uraw; } elsif ($$otext eq $$utext) { # No update: users version can be used print @$mraw; } elsif (($$otext eq $$mtext) || ($$mtext eq $$utext)) { # No mod: new version can be used print @$uraw; } else { # WTF? print uSTDERR "Original:\n@$oraw\n\n"; print STDERR "Modified:\n@$mraw\n\n"; print STDERR "Updated:\n@$uraw\n\n"; print STDERR "Use [M]odified or [U]pdated? "; if (=~/^m/i) { print @$mraw } else { print @$uraw } # Ugh! } } --------8<----------------- You shouldn't do this sorta thing when you're not feeling too well. --- þ Synchronet þ Great programs on the Synchronet Channel at The ANJO BBS .