]>
Commit | Line | Data |
---|---|---|
6a9b3198 | 1 | #!/bin/sh |
3c0ef626 | 2 | # |
3 | # fixpaths - substitute makefile variables into text files | |
6a9b3198 | 4 | # Usage: fixpaths -Dsomething=somethingelse ... |
3c0ef626 | 5 | |
6a9b3198 | 6 | die() { |
7 | echo $* | |
8 | exit -1 | |
3c0ef626 | 9 | } |
10 | ||
6a9b3198 | 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. | |
3c0ef626 | 16 | |
6a9b3198 | 17 | test -n "`echo $*|grep -- ' [^-]'`" || \ |
18 | die Usage: $0 '[-Dstring=replacement] [[infile] ...]' | |
3c0ef626 | 19 | |
6a9b3198 | 20 | sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'` |
3c0ef626 | 21 | |
6a9b3198 | 22 | exit 0 |