]>
Commit | Line | Data |
---|---|---|
a76550cf | 1 | #!/bin/sh |
d2dcff5f | 2 | # |
3 | # fixpaths - substitute makefile variables into text files | |
a76550cf | 4 | # Usage: fixpaths -Dsomething=somethingelse ... |
d2dcff5f | 5 | |
a76550cf | 6 | die() { |
7 | echo $* | |
8 | exit -1 | |
d2dcff5f | 9 | } |
10 | ||
a76550cf | 11 | test -n "`echo $1|grep -- -D`" || \ |
12 | die $0: nothing to do - no substitutions listed! | |
13 | ||
14 | test -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || \ | |
15 | die $0: error in command line arguments. | |
d2dcff5f | 16 | |
a76550cf | 17 | test -n "`echo $*|grep -- ' [^-]'`" || \ |
18 | die Usage: $0 '[-Dstring=replacement] [[infile] ...]' | |
d2dcff5f | 19 | |
a76550cf | 20 | sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'` |
d2dcff5f | 21 | |
a76550cf | 22 | exit 0 |