blob: a265dc2d5f12b84a65fa3d88b00135b80b83b86a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/perl
# $OpenBSD: setdate.pl,v 1.1 2008/03/10 20:03:21 tobias Exp $
#
# Sets "date x;" of specified revision in rcsfile to date.
# This script is needed to make -D checks available. CVS adjusts dates
# to gmt, so it is impossible to write tests which can be used in
# all timezones.
#
# usage: setdate.pl rcsfile revision date
my $gotrev;
my @lines;
die "usage: setdate.pl file revision date\n" if ($#ARGV != 2);
open FILE, "< $ARGV[0]" or die "cannot open file $ARGV[0] for reading\n";
@lines = <FILE>;
close FILE;
$gotrev = 0;
open FILE, "> $ARGV[0]" or die "cannot open file $ARGV[0] for writing\n";
for (@lines) {
if ($gotrev) {
if (m/^date\s+(.*?);/) {
s/$1/$ARGV[2]/;
break;
}
$gotrev = 0;
}
$gotrev = 1 if (m/^$ARGV[1]\n$/);
print FILE "$_";
}
close FILE;
|