2002-12-05 09:59:33 +00:00
|
|
|
#!/bin/sh
|
1999-12-26 22:23:58 +00:00
|
|
|
#
|
|
|
|
# fixpaths - substitute makefile variables into text files
|
2002-12-05 09:59:33 +00:00
|
|
|
# Usage: fixpaths -Dsomething=somethingelse ...
|
1999-12-26 22:23:58 +00:00
|
|
|
|
2002-12-05 09:59:33 +00:00
|
|
|
die() {
|
|
|
|
echo $*
|
|
|
|
exit -1
|
1999-12-26 22:23:58 +00:00
|
|
|
}
|
|
|
|
|
2002-12-05 09:59:33 +00:00
|
|
|
test -n "`echo $1|grep -- -D`" || \
|
|
|
|
die $0: nothing to do - no substitutions listed!
|
|
|
|
|
|
|
|
test -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || \
|
|
|
|
die $0: error in command line arguments.
|
1999-12-26 22:23:58 +00:00
|
|
|
|
2002-12-05 09:59:33 +00:00
|
|
|
test -n "`echo $*|grep -- ' [^-]'`" || \
|
|
|
|
die Usage: $0 '[-Dstring=replacement] [[infile] ...]'
|
1999-12-26 22:23:58 +00:00
|
|
|
|
2002-12-05 09:59:33 +00:00
|
|
|
sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`
|
1999-12-26 22:23:58 +00:00
|
|
|
|
2002-12-05 09:59:33 +00:00
|
|
|
exit 0
|