xref: /openbsd/gnu/usr.bin/gcc/contrib/index-prop (revision 7e568061)
1*7e568061Sespie#! /usr/bin/perl -wi
2*7e568061Sespie# Fix up the output of cvs diff -c so that it works with patch.
3*7e568061Sespie# We do this by propagating the full pathname from the Index: line
4*7e568061Sespie# into the diff itself.
5*7e568061Sespie#
6*7e568061Sespie# Thrown together by Jason Merrill <jason@cygnus.com>
7*7e568061Sespie
8*7e568061Sespiewhile (<>)
9*7e568061Sespie{
10*7e568061Sespie  if (/^Index: (.*)/)
11*7e568061Sespie    {
12*7e568061Sespie      $full = $1;
13*7e568061Sespie      print;
14*7e568061Sespie      for (1..7)
15*7e568061Sespie	{
16*7e568061Sespie	  $_ = <>;
17*7e568061Sespie	  s/^([-+*]{3}) [^\t]+\t/$1 $full\t/
18*7e568061Sespie	    unless m{ /dev/null\t};
19*7e568061Sespie	  print;
20*7e568061Sespie	}
21*7e568061Sespie    }
22*7e568061Sespie  else
23*7e568061Sespie    {
24*7e568061Sespie      print;
25*7e568061Sespie    }
26*7e568061Sespie}
27