Incompatibility of PIC and non-PIC
David Huggins-Daines
dhd@linuxcare.com
21 Aug 2000 09:41:18 -0400
Alan Modra <alan@linuxcare.com.au> writes:
> I haven't found one, and it's a real pain. I tend to edit patches
> covering multiple directories before passing them to patch.
>
> "sed -e '/^[+-][+-]/d' < cvs_diff_file | patch -p0 --posix" ought to work.
Here's a tiny Perl script I wrote for this purpose once in a fit of
pique. Use the -i option to specify the 'input' directory prefix
(i.e. in the --- line) and -o to specify the 'output' directory
prefix.
#!/usr/bin/perl -p
use strict;
use File::Basename;
use vars qw($in $out $path $name $dir);
BEGIN {
my @args;
while (defined($_ = shift)) {
if (/-i/) {
$in = shift;
$in =~ s,$,/,;
$in =~ tr,/,,s;
} elsif (/-o/) {
$out = shift;
$out =~ s,$,/,;
$out =~ tr,/,,s;
} else {
push @args, $_;
}
}
$out ||= $in;
$in ||= $out;
@ARGV=@args;
}
/^Index: (.*)/ and do {
($name, $dir) = fileparse($1);
};
/^(---|\+\+\+) ([^\t]+)/ and do {
die "Your CVS isn't broken, $2 doesn't match $name\n" unless $2 eq $name;
my $prefix = ($1 eq '---') ? $in : $out;
s,$2,${prefix}${dir}${name},;
};
--
dhd@linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.