fixpaths revision 256281
11590Srgrimes#!/bin/sh
21590Srgrimes#
31590Srgrimes# fixpaths  - substitute makefile variables into text files
41590Srgrimes# Usage: fixpaths -Dsomething=somethingelse ...
51590Srgrimes
61590Srgrimesdie() {
71590Srgrimes	echo $*
81590Srgrimes	exit -1
91590Srgrimes}
101590Srgrimes
111590Srgrimestest -n "`echo $1|grep -- -D`" || \
121590Srgrimes	die $0: nothing to do - no substitutions listed!
131590Srgrimes
141590Srgrimestest -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || \
151590Srgrimes	die $0: error in command line arguments.
161590Srgrimes
171590Srgrimestest -n "`echo $*|grep -- ' [^-]'`" || \
181590Srgrimes	die Usage: $0 '[-Dstring=replacement] [[infile] ...]'
191590Srgrimes
201590Srgrimessed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`
211590Srgrimes
221590Srgrimesexit 0
231590Srgrimes