blob: 60a67990f173e053ed7bdd9da5a11c3d1955937e [file] [log] [blame]
Damien Millerab1c12a2002-12-05 20:59:33 +11001#!/bin/sh
Damien Millerc0d73901999-12-27 09:23:58 +11002#
3# fixpaths - substitute makefile variables into text files
Damien Millerab1c12a2002-12-05 20:59:33 +11004# Usage: fixpaths -Dsomething=somethingelse ...
Damien Millerc0d73901999-12-27 09:23:58 +11005
Damien Millerab1c12a2002-12-05 20:59:33 +11006die() {
7 echo $*
8 exit -1
Damien Millerc0d73901999-12-27 09:23:58 +11009}
10
Damien Millerab1c12a2002-12-05 20:59:33 +110011test -n "`echo $1|grep -- -D`" || \
12 die $0: nothing to do - no substitutions listed!
Damien Millerc0d73901999-12-27 09:23:58 +110013
Damien Millerab1c12a2002-12-05 20:59:33 +110014test -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || \
15 die $0: error in command line arguments.
Damien Millerc0d73901999-12-27 09:23:58 +110016
Damien Millerab1c12a2002-12-05 20:59:33 +110017test -n "`echo $*|grep -- ' [^-]'`" || \
18 die Usage: $0 '[-Dstring=replacement] [[infile] ...]'
Damien Millerc0d73901999-12-27 09:23:58 +110019
Damien Millerab1c12a2002-12-05 20:59:33 +110020sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`
21
22exit 0