#!/u2/consultants/brandon/bin/p
#
# it is perl, Ultrix doesn't like the above line to be longer than ~30
# characters, so I softlinked p to perl.
#
# this munches on the headers of each file for each archive, and is
# rather useless for anything else.
#
# -Brandon
select(STDOUT); $|=1;
@months = ("Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec");
###############################
# get the head
open(HEAD, ">$$.head");
print HEAD<<END;
/*
// ColdMUD was created and is copyright 1993, 1994 by Greg Hudson
//
// ColdX is a derivitive work, and is copyright 1995 by the ColdX Project.
// Full copyright information can be found in the file doc/CREDITS
//
// @@@FILE@@@
// @@@VERSION@@@
// @@@DATE@@@
// ---
END
close(HEAD);
###############################
# get the version
open(FILE, "../etc/version");
$ver = <FILE>;
chop $ver;
close(FILE);
###############################
# Loop n stuff
for (@ARGV) {
$file = $_;
print "$file...\n";
open(FILE, $file);
$line = <FILE>;
chop $line;
close(FILE);
# Date is rather useless, but cute.
open(FILE, "$file");
@stuff = stat(FILE);
@time = localtime($stuff[9]);
$date = "$time[3]-$months[$time[4]]-19$time[5]";
open(OUT, ">$$.out");
open(HEAD, "$$.head");
if ($line =~ /^\/\* \@\@\@HEAD\@\@\@.*$/) {
<FILE>;
}
while (<HEAD>) {
$_ =~ s/\@\@\@FILE\@\@\@/File: $file/;
$_ =~ s/\@\@\@VERSION\@\@\@/Version: $ver/;
$_ =~ s/\@\@\@DATE\@\@\@/Date: $date/;
print(OUT);
}
while (<FILE>) {
print(OUT);
}
close(HEAD);
close(FILE);
close(OUT);
system("mv", "$file", "$file.orig");
system("mv", "$$.out", "$file");
}
system("rm", "-f", "$$.out", "$$.head");