1998-06-13 02:34:39 +04:00
|
|
|
#!/usr/local/bin/perl
|
|
|
|
|
|
|
|
require "find.pl";
|
|
|
|
|
|
|
|
$uuid = 0x6f7652e0;
|
1998-06-23 22:43:06 +04:00
|
|
|
$format = "{ 0x%x, 0xee43, 0x11d1, \\\
|
1998-06-13 02:34:39 +04:00
|
|
|
{ 0x9b, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }";
|
|
|
|
$pattern = "--- IID GOES HERE ---";
|
1998-07-03 04:48:06 +04:00
|
|
|
$mydir = cwd();
|
1998-06-13 02:34:39 +04:00
|
|
|
|
|
|
|
sub replaceText {
|
|
|
|
local ($oldname) = $_;
|
|
|
|
local ($newname) = $_;
|
|
|
|
local ($found) = 0;
|
|
|
|
local ($tempname) = $oldname.'.orig';
|
|
|
|
local ($replacement);
|
|
|
|
|
|
|
|
if (-T $oldname && -s $oldname) {
|
|
|
|
open(FILE, "<$oldname")
|
|
|
|
|| die "Unable to open $oldname\n";
|
|
|
|
while (<FILE>) {
|
|
|
|
if (/$pattern/) {
|
|
|
|
$found = 1;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close(FILE);
|
|
|
|
|
|
|
|
if ($found) {
|
1998-07-03 04:48:06 +04:00
|
|
|
print "Setting IID for file: ", $oldname, "\n";
|
1998-06-13 02:34:39 +04:00
|
|
|
rename($oldname, $tempname)
|
|
|
|
|| die "Unable to rename $oldname as $tempname";
|
|
|
|
open(REPLACEFILE, ">$newname")
|
|
|
|
|| die "Unable to open $newname for writing\n";
|
|
|
|
|
|
|
|
open(SEARCHFILE, "<$tempname")
|
|
|
|
|| die "Unable to open $tempname\n";
|
|
|
|
|
|
|
|
while (<SEARCHFILE>) {
|
|
|
|
if (/$pattern/) {
|
|
|
|
$replacement = sprintf($format, $uuid++);
|
|
|
|
s/$pattern/$replacement /g;
|
|
|
|
}
|
|
|
|
print REPLACEFILE;
|
|
|
|
}
|
|
|
|
close(SEARCHFILE);
|
|
|
|
close(REPLACEFILE);
|
|
|
|
if (-z $newname) {
|
|
|
|
die "$newname has zero size\n."
|
|
|
|
."Restore manually from $tempname\n";
|
|
|
|
} else {
|
|
|
|
unlink($tempname);
|
|
|
|
}
|
|
|
|
|
|
|
|
warn "$name: Renaming as $newname\n" if $newname ne $oldname;
|
|
|
|
|
|
|
|
$_ = $oldname;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($newname ne $oldname) {
|
|
|
|
warn "$name: Renaming as $newname\n";
|
|
|
|
rename($oldname, $newname) || warn "Unable to rename $oldname\n";
|
|
|
|
}
|
|
|
|
$_ = $oldname;
|
|
|
|
}
|
|
|
|
|
|
|
|
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
|
|
|
|
if $running_under_some_shell;
|
|
|
|
|
|
|
|
# Traverse desired filesystems
|
|
|
|
$dont_use_nlink = 1;
|
|
|
|
|
|
|
|
if (!$ARGV[0]) {
|
|
|
|
&find('.');
|
|
|
|
}
|
|
|
|
else {
|
1998-07-03 04:48:06 +04:00
|
|
|
foreach $file (@ARGV) {
|
|
|
|
chdir $mydir
|
|
|
|
&find($file);
|
|
|
|
}
|
1998-06-13 02:34:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
sub wanted {
|
|
|
|
/^nsIDOM.*\.h$/ &&
|
|
|
|
&replaceText($name);
|
|
|
|
}
|