Revision 16801,
907 bytes
checked in by ghudson, 23 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r16800,
which included commits to RCS files with non-trunk default branches.
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | #!/usr/bin/perl -w |
---|
2 | # |
---|
3 | # fixpaths - substitute makefile variables into text files |
---|
4 | |
---|
5 | |
---|
6 | $usage = "Usage: $0 [-Dstring=replacement] [[infile] ...]\n"; |
---|
7 | |
---|
8 | if (!defined(@ARGV)) { die ("$usage"); } |
---|
9 | |
---|
10 | # read in the command line and get some definitions |
---|
11 | while ($_=$ARGV[0], /^-/) { |
---|
12 | if (/^-D/) { |
---|
13 | # definition |
---|
14 | shift(@ARGV); |
---|
15 | if ( /-D(.*)=(.*)/ ) { |
---|
16 | $def{"$1"}=$2; |
---|
17 | } else { |
---|
18 | die ("$usage$0: error in command line arguments.\n"); |
---|
19 | } |
---|
20 | } else { |
---|
21 | @cmd = split(//, $ARGV[0]); $opt = $cmd[1]; |
---|
22 | die ("$usage$0: unknown option '-$opt'\n"); |
---|
23 | } |
---|
24 | } # while parsing arguments |
---|
25 | |
---|
26 | if (!defined(%def)) { |
---|
27 | die ("$0: nothing to do - no substitutions listed!\n"); |
---|
28 | } |
---|
29 | |
---|
30 | for $f (@ARGV) { |
---|
31 | |
---|
32 | $f =~ /(.*\/)*(.*)$/; |
---|
33 | |
---|
34 | open(IN, "<$f") || die ("$0: input file $f missing!\n"); |
---|
35 | while (<IN>) { |
---|
36 | for $s (keys(%def)) { |
---|
37 | s#$s#$def{$s}#; |
---|
38 | } # for $s |
---|
39 | print; |
---|
40 | } # while <IN> |
---|
41 | } # for $f |
---|
42 | |
---|
43 | exit 0; |
---|
Note: See
TracBrowser
for help on using the repository browser.