summaryrefslogtreecommitdiff
path: root/fixpaths
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-04-16 10:41:46 +1000
committerDamien Miller <djm@mindrot.org>2001-04-16 10:41:46 +1000
commit897741eeaa0ebb5e2ce10a6b0ada8f3e55d22777 (patch)
tree5cab7cc53a9910aee7e932c74ee56555a30621ba /fixpaths
parent206941fdd88031e76da1e2aa0b5dd3b8d1d5d38b (diff)
- (djm) Convert mandoc manpages to man automatically. Patch from Mark D.
Roth <roth+openssh@feep.net>
Diffstat (limited to 'fixpaths')
-rwxr-xr-xfixpaths12
1 files changed, 3 insertions, 9 deletions
diff --git a/fixpaths b/fixpaths
index edd9e486f..7e4178e4a 100755
--- a/fixpaths
+++ b/fixpaths
@@ -3,21 +3,17 @@
3# fixpaths - substitute makefile variables into text files 3# fixpaths - substitute makefile variables into text files
4 4
5 5
6$usage = "Usage: $0 [-x<file dot-suffix>] [-Dstring=replacement] [[infile] ...]\n"; 6$usage = "Usage: $0 [-Dstring=replacement] [[infile] ...]\n";
7
8$ext="out";
9 7
10if (!defined(@ARGV)) { die ("$usage"); } 8if (!defined(@ARGV)) { die ("$usage"); }
11 9
12# read in the command line and get some definitions 10# read in the command line and get some definitions
13while ($_=$ARGV[0], /^-/) { 11while ($_=$ARGV[0], /^-/) {
14 if (/^-[Dx]/) { 12 if (/^-D/) {
15 # definition 13 # definition
16 shift(@ARGV); 14 shift(@ARGV);
17 if ( /-D(.*)=(.*)/ ) { 15 if ( /-D(.*)=(.*)/ ) {
18 $def{"$1"}=$2; 16 $def{"$1"}=$2;
19 } elsif ( /-x\s*(\w+)/ ) {
20 $ext=$1;
21 } else { 17 } else {
22 die ("$usage$0: error in command line arguments.\n"); 18 die ("$usage$0: error in command line arguments.\n");
23 } 19 }
@@ -34,15 +30,13 @@ if (!defined(%def)) {
34for $f (@ARGV) { 30for $f (@ARGV) {
35 31
36 $f =~ /(.*\/)*(.*)$/; 32 $f =~ /(.*\/)*(.*)$/;
37 $of = $2.".$ext";
38 33
39 open(IN, "<$f") || die ("$0: input file $f missing!\n"); 34 open(IN, "<$f") || die ("$0: input file $f missing!\n");
40 open(OUT, ">$of") || die ("$0: cannot create output file $of: $!\n");
41 while (<IN>) { 35 while (<IN>) {
42 for $s (keys(%def)) { 36 for $s (keys(%def)) {
43 s#$s#$def{$s}#; 37 s#$s#$def{$s}#;
44 } # for $s 38 } # for $s
45 print OUT; 39 print;
46 } # while <IN> 40 } # while <IN>
47} # for $f 41} # for $f
48 42