gno/doc/refs/getdate

54 lines
982 B
Plaintext
Raw Normal View History

#! /usr/bin/perl -s
#
# Extract the date from the RCS Id string in a file.
#
# $Id: getdate,v 1.1 1997/11/24 05:07:27 gdr Exp $
#
push(@month,
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec" );
# for ($i=0; $i<12; $i++) {
# printf("month %d is %s\n", $i, $month[$i]);
# }
if (defined($date)) {
$printdate = 1;
}
if (defined($version)) {
$printversion = 1;
}
while(<>) {
if (/\$Id([^\$]*)\$/) {
$_ = $1;
if (/^:\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+/) {
$file=$1;
$version=$2;
$rawdate=$3;
$time=$4;
if ($rawdate =~ m,(\d+)/(\d+)/(\d+),) {
$year = $1;
$m = $2;
$day = $3;
$mon = @month[int($2) - 1];
$date = "$day $mon $year";
}
} else {
$date = "(unspecified date)";
}
if ($printdate) {
printf("%s\n", $date);
} elsif ($printversion) {
printf("%s\n", $version);
} else {
printf("getdate: bad invocation\n");
exit(1);
}
exit(0);
}
}
exit(1);