2003-04-23 16:53:02 +00:00
|
|
|
#!/bin/sh
|
2002-06-27 22:31:32 +00:00
|
|
|
#
|
|
|
|
# fixpaths - substitute makefile variables into text files
|
2003-04-23 16:53:02 +00:00
|
|
|
# Usage: fixpaths -Dsomething=somethingelse ...
|
2002-06-27 22:31:32 +00:00
|
|
|
|
2003-04-23 16:53:02 +00:00
|
|
|
die() {
|
|
|
|
echo $*
|
|
|
|
exit -1
|
2002-06-27 22:31:32 +00:00
|
|
|
}
|
|
|
|
|
2003-04-23 16:53:02 +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.
|
2002-06-27 22:31:32 +00:00
|
|
|
|
2003-04-23 16:53:02 +00:00
|
|
|
test -n "`echo $*|grep -- ' [^-]'`" || \
|
|
|
|
die Usage: $0 '[-Dstring=replacement] [[infile] ...]'
|
2002-06-27 22:31:32 +00:00
|
|
|
|
2003-04-23 16:53:02 +00:00
|
|
|
sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`
|
2002-06-27 22:31:32 +00:00
|
|
|
|
2003-04-23 16:53:02 +00:00
|
|
|
exit 0
|