Massive patch for the first months work adding System FC to GHC #15
[ghc-hetmet.git] / InstallShield / decyg.pl
1 #!/usr/bin/perl
2 # Patch a DLL or EXE to change the name of the Cygwin DLL it uses or is, so that we can
3 # include our own Cygwin DLL that doesn't interfere with the rest of the system, for great justice
4
5 @ARGV = ('-') unless @ARGV;
6 @FILES = @ARGV;
7 while ($ARGV = shift) {
8   $out = $ARGV . ".new";
9   open(IN, $ARGV) or warn "Can't open $ARGV: $!\n";
10   open(OUT, ">$out") or warn "Can't open $out: $!\n";
11   binmode IN;
12   while (<IN>) {
13     s/cygwin1/aybabtu/g;
14     s/c\000y\000g\000w\000i\000n\0001/a\000y\000b\000a\000b\000t\000u/g;
15     print OUT;
16   }
17   close IN;
18   close OUT;
19   unlink $ARGV;
20   rename $out, $ARGV;
21 }