]> andersk Git - openssh.git/blame - fixpaths
- (djm) Convert mandoc manpages to man automatically. Patch from Mark D.
[openssh.git] / fixpaths
CommitLineData
d2dcff5f 1#!/usr/bin/perl -w
2#
3# fixpaths - substitute makefile variables into text files
4
5
5d97cfbf 6$usage = "Usage: $0 [-Dstring=replacement] [[infile] ...]\n";
d2dcff5f 7
8if (!defined(@ARGV)) { die ("$usage"); }
9
10# read in the command line and get some definitions
11while ($_=$ARGV[0], /^-/) {
5d97cfbf 12 if (/^-D/) {
d2dcff5f 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 {
e1b37056 21 @cmd = split(//, $ARGV[0]); $opt = $cmd[1];
22 die ("$usage$0: unknown option '-$opt'\n");
d2dcff5f 23 }
24} # while parsing arguments
25
26if (!defined(%def)) {
27 die ("$0: nothing to do - no substitutions listed!\n");
28}
29
30for $f (@ARGV) {
31
32 $f =~ /(.*\/)*(.*)$/;
d2dcff5f 33
d2dcff5f 34 open(IN, "<$f") || die ("$0: input file $f missing!\n");
e506ee73 35 while (<IN>) {
36 for $s (keys(%def)) {
37 s#$s#$def{$s}#;
38 } # for $s
5d97cfbf 39 print;
e506ee73 40 } # while <IN>
d2dcff5f 41} # for $f
42
43exit 0;
This page took 0.093912 seconds and 5 git commands to generate.