darling-dyld/bin/set-alt-dyld
2022-04-18 20:33:29 -07:00

31 lines
442 B
Perl
Executable File

#!/usr/bin/perl -w
use strict;
undef $/;
if(@ARGV == 0)
{
print "Usage: $0 <macho-executable> [<macho-executable> ...]\n";
exit 1;
}
my $arg;
foreach $arg (@ARGV)
{
open IN, "<$arg" or die $!;
my $in = <IN>;
close IN or die $!;
if($in =~ s{/usr/lib/dyld}{/usr/local/dy})
{
open OUT, ">$arg" or die $!;
print OUT $in;
close OUT or die $!;
}
else
{
print STDERR "ERROR: $arg\n";
exit 1;
}
}