2002-12-05 17:59:33 +08:00
|
|
|
#!/bin/sh
|
1999-12-27 06:23:58 +08:00
|
|
|
#
|
|
|
|
# fixpaths - substitute makefile variables into text files
|
2002-12-05 17:59:33 +08:00
|
|
|
# Usage: fixpaths -Dsomething=somethingelse ...
|
1999-12-27 06:23:58 +08:00
|
|
|
|
2002-12-05 17:59:33 +08:00
|
|
|
die() {
|
|
|
|
echo $*
|
|
|
|
exit -1
|
1999-12-27 06:23:58 +08:00
|
|
|
}
|
|
|
|
|
2002-12-05 17:59:33 +08: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-27 06:23:58 +08:00
|
|
|
|
2002-12-05 17:59:33 +08:00
|
|
|
test -n "`echo $*|grep -- ' [^-]'`" || \
|
|
|
|
die Usage: $0 '[-Dstring=replacement] [[infile] ...]'
|
1999-12-27 06:23:58 +08:00
|
|
|
|
2002-12-05 17:59:33 +08:00
|
|
|
sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`
|
1999-12-27 06:23:58 +08:00
|
|
|
|
2002-12-05 17:59:33 +08:00
|
|
|
exit 0
|