Commit | Line | Data |
137443ea |
1 | my %opt; |
2 | while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/) |
3 | { |
4 | $opt{$1}=$2; |
5 | shift(@ARGV); |
6 | } |
7bac28a0 |
7 | |
c90c0ff4 |
8 | if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true |
9 | $opt{PATCHLEVEL} = int($1 || 0); |
10 | $opt{SUBVERSION} = $2 || '00'; |
11 | } |
12 | |
d484a829 |
13 | $opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'}; |
14 | $opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0] |
15 | unless $opt{'cf_email'}; |
16 | |
137443ea |
17 | while (<>) |
18 | { |
19 | s/~([\w_]+)~/$opt{$1}/g; |
dc050285 |
20 | if (/^([\w_]+)=(.*)$/) { |
21 | # this depends on cf_time being empty in the template (or we'll get a loop) |
22 | if ($1 eq 'cf_time') { |
23 | $_ = "$1='" . localtime(time) . "'\n" if $2 =~ /^\s*'\s*'/; |
24 | } |
25 | elsif (exists $opt{$1}) { |
26 | $_ = "$1='$opt{$1}'\n"; |
27 | } |
28 | } |
137443ea |
29 | print; |
30 | } |
31 | |