Re: [PATCH] kconfig: simplification of scripts/extract-ikconfig

From: Amerigo Wang
Date: Sun Jun 28 2009 - 22:49:52 EST


On Wed, Jun 24, 2009 at 03:31:48PM +0200, Dick Streefland wrote:
>On Wednesday 2009-06-24 13:46, Dick Streefland wrote:
>| Because I don't want to rely on a particular version of grep, I've
>| modified the script to use perl instead. I hope that's OK. Below is
>| a new patch.
><snip>


Sorry for the delay, I missed this patch...

>
>I found a way to work around the differences in behavior of grep.
>Older versions of grep report the byte offset of the start of the
>line instead of the byte offset of the pattern. By using tr to
>make sure the pattern is always at the start of a "line", both old
>and new versions of grep can be used.


This is very tricky...

<snip>

>+
>+gz1='\037\213\010'
>+gz2='01'
>+cf1='IKCFG_ST\037\213\010'
>+cf2='0123456789'
>+
>+dump_config()
> {
>- echo " usage: extract-ikconfig [b]zImage_filename"
>-}
>-
>-clean_up()
>-{
>- if [ "$TMPFILE" != "" ]; then
>- rm -f $TMPFILE
>+ if pos=`tr "$cf1\n$cf2" "\n$cf2=" < "$1" | grep -abo "^$cf2"`


Does this work?
My quick test shows no...

I still can't get the right offset number with this trick.

P.S. My grep is 2.5.1.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/