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