~ubuntu-branches/ubuntu/breezy/atool/breezy

3 by Stephane Jourdois
* Use rar as unpacker for rar archives by default (Closes: #273009).
1
#!/usr/bin/perl -w
2
# This script reads configure.ac, and replaces all occurences of
3
# @.+@ in script and manpage with values.
4
# It returns 0 on success, 1 if it missed something.
5
#
6
# Stéphane (kwisatz) Jourdois <kwisatz@rubis.org>
7
# Mon, 16 Aug 2004 15:22:24 +0200
8
9
use strict;
10
11
my %vars = (
12
	'PERL' => '/usr/bin/perl',
13
);
14
15
my ($from, $to) = @ARGV;
16
17
open AC, '<configure.ac' or die "Cannot read configure.ac: $!\n";
18
19
while (<AC>) {
20
	if (/^AC_INIT\((\w+), ([0-9.]+), .+\)/) {
21
		$vars{'PACKAGE_NAME'} = $1;
22
		$vars{'PACKAGE_VERSION'} = $2;
23
24
		# Remove this line if there is are
25
		# other interesting lines in configure.ac
26
		# For now there isn't.
27
		last;
28
	}
29
}
30
close AC;
31
32
open FROM, "<$from" or die "Cannot read $from: $!\n";
33
open TO, ">$to" or die "Cannot write $to: $!\n";
34
35
while (<FROM>) {
36
	for my $var (keys %vars) {
37
		s/\@$var\@/$vars{$var}/g;
38
	}
39
	print TO;
40
}
41
42
close FROM;
43
close TO;