summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/bin/filedate
blob: 8149b5e57bdd048ebc1966e1f64551c0f26ef489 (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
35
36
37
38
39
40
41
42
#!/usr/bin/perl -w
#######################################################################################
# A tool for updating .dtx files with a given package date.                           #
# Copyright (c) 2010, Deyan Ginev, released under the Gnu General Public License (GPL)#
#                                 see http://www.gnu.org/copyleft/gpl.html            #
# $URL: https://svn.kwarc.info/repos/stex/trunk/bin/filedate$                         #
#######################################################################################

use strict;

use Getopt::Long;
use Modparse;
use Pod::Usage;
use Cwd qw(abs_path);

my ($file,$date) = @ARGV;
$file = abs_path($file);
open(IN,"<$file");
my @lines = ();
while (<IN>) {
  if ($_ =~ /\\Provides(Package|Class)/) {
    $_ =~ s/\[(.*?)\s/\[$date /;
  }
  push @lines, $_;
}
close(IN);
open(OUT,">$file");
print OUT join("",@lines);
close(OUT);

__END__


=head1 SYNOPSIS

filedate <input filename> <newdate>

Purpose:
    Update the dates for a \ProvidePackage invocation in a given .dtx source

Example:
    filedate omdoc.dtx "2010/06/24"