From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Thu, 13 Aug 2009 10:28:09 -0500 Subject: [U-Boot] [PATCH] Add support to mkconfig for setting simple #defines in config.h In-Reply-To: <200908130115.35378.vapier@gentoo.org> References: <1249653783-16727-1-git-send-email-galak@kernel.crashing.org> <20090807192215.GA11689@b07421-ec1.am.freescale.net> <200908130115.35378.vapier@gentoo.org> Message-ID: <4A843109.60609@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Mike Frysinger wrote: > On Friday 07 August 2009 15:22:15 Scott Wood wrote: >> On Fri, Aug 07, 2009 at 09:03:03AM -0500, Kumar Gala wrote: >>> while [ $# -gt 0 ] ; do >>> case "$1" in >>> --) shift ; break ;; >>> -a) shift ; APPEND=yes ;; >>> -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;; >>> + -D) shift ; DEFINES="#define ${1/=/\t}\n"${DEFINES} ; shift ;; >> How about something like: >> >> -D) shift ; DEFINES="${1//_/ } ${DEFINES}"; shift ;; > > mkconfig's interpreter is /bin/sh, so if you want to use the string replace > bashism, you'll have to change it to /bin/bash. or use the POSIX: > "#define ${1%%=*}\t${1#*=}\n${DEFINES}" Do you have a non-bash version of my alternative (which handles multiple symbols rather than one symbol/value pair per -D)? Or do we need to invoke sed to be portable? Or can we just use bash? :-) -Scott