summaryrefslogtreecommitdiff
path: root/other/ssharp/fixpaths
diff options
context:
space:
mode:
authorSkyperTHC2026-03-03 06:28:55 +0000
committerSkyperTHC2026-03-03 06:28:55 +0000
commit5d3573ef7a109ee70416fe94db098fe6a769a798 (patch)
treedc2d5b294c9db8ab2db7433511f94e1c4bb8b698 /other/ssharp/fixpaths
parentc6c59dc73cc4586357f93ab38ecf459e98675cc5 (diff)
packetstorm sync
Diffstat (limited to 'other/ssharp/fixpaths')
-rwxr-xr-xother/ssharp/fixpaths43
1 files changed, 43 insertions, 0 deletions
diff --git a/other/ssharp/fixpaths b/other/ssharp/fixpaths
new file mode 100755
index 0000000..7e4178e
--- /dev/null
+++ b/other/ssharp/fixpaths
@@ -0,0 +1,43 @@
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
8if (!defined(@ARGV)) { die ("$usage"); }
9
10# read in the command line and get some definitions
11while ($_=$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
26if (!defined(%def)) {
27 die ("$0: nothing to do - no substitutions listed!\n");
28}
29
30for $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
43exit 0;