blob: 60a67990f173e053ed7bdd9da5a11c3d1955937e [file] [log] [blame]
Greg Hartmanbd77cf72015-02-25 13:21:06 -08001#!/bin/sh
2#
3# fixpaths - substitute makefile variables into text files
4# Usage: fixpaths -Dsomething=somethingelse ...
5
6die() {
7 echo $*
8 exit -1
9}
10
11test -n "`echo $1|grep -- -D`" || \
12 die $0: nothing to do - no substitutions listed!
13
14test -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || \
15 die $0: error in command line arguments.
16
17test -n "`echo $*|grep -- ' [^-]'`" || \
18 die Usage: $0 '[-Dstring=replacement] [[infile] ...]'
19
20sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`
21
22exit 0