1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-12-28 16:15:02 +01:00
This commit is contained in:
Wayne Davison 2007-12-04 01:40:18 +00:00
parent 61320c44c1
commit a58d118753
2 changed files with 13 additions and 10 deletions

View file

@ -3,6 +3,10 @@
* 24148: configure.ac, Src/utils.c: attempt to use strerror_r() * 24148: configure.ac, Src/utils.c: attempt to use strerror_r()
to make error messages in signal handle safer. to make error messages in signal handle safer.
2007-12-03 Wayne Davison <wayned@users.sourceforge.net>
* 24147: Util/difflog.pl: improved the temporary-file handling.
2007-12-03 Peter Stephenson <pws@csr.com> 2007-12-03 Peter Stephenson <pws@csr.com>
* 24143: Etc/zsh-development-guide, Util/.distfiles: Remove * 24143: Etc/zsh-development-guide, Util/.distfiles: Remove

View file

@ -2,10 +2,9 @@
use strict; use strict;
use IO::File; use IO::File;
use File::Temp qw(tempfile);
my @differ = qw(diff -bw); my @differ = qw(diff -bw);
my $oldtmp = "/tmp/difflog$$.old";
my $newtmp = "/tmp/difflog$$.new";
my $newfn = pop(@ARGV); my $newfn = pop(@ARGV);
my $oldfn = pop(@ARGV); my $oldfn = pop(@ARGV);
@ -36,16 +35,16 @@ while ($old < @oldentries && $new < @newentries)
else else
{ {
if ($oldhash{$oldentries[$old]} ne $newhash{$newentries[$new]}) { if ($oldhash{$oldentries[$old]} ne $newhash{$newentries[$new]}) {
my $oldfh = new IO::File("/tmp/difflog$$.old", 'w'); my($oldfh, $oldtmp) = tempfile('difflog-XXXXXXXX', SUFFIX => '.old', DIR => '/tmp');
$oldfh->print($oldhash{$oldentries[$old]}); print $oldfh $oldhash{$oldentries[$old]};
$oldfh->close(); close($oldfh);
my $newfh = new IO::File("/tmp/difflog$$.new", 'w'); my($newfh, $newtmp) = tempfile('difflog-XXXXXXXX', SUFFIX => '.new', DIR => '/tmp');
$newfh->print($newhash{$newentries[$new]}); print $newfh $newhash{$newentries[$new]};
$newfh->close(); close($newfh);
open(DIFF, join(' ', @differ, @ARGV, $oldtmp, $newtmp, '|')); open(DIFF, '-|', @differ, @ARGV, $oldtmp, $newtmp) or die $!;
my @lines = <DIFF>; my @lines = <DIFF>;
close(DIFF); close(DIFF);
unlink </tmp/difflog$$.*>; unlink($oldtmp, $newtmp);
if (@lines) if (@lines)
{ {
print "diff for ", $oldentries[$old], ":\n"; print "diff for ", $oldentries[$old], ":\n";