public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jerry Van Baren <gerald.vanbaren@ge.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_fdt.c: fix parse of byte streams and	strings
Date: Fri, 11 Sep 2009 12:30:57 -0400	[thread overview]
Message-ID: <4AAA7B41.3020505@ge.com> (raw)
In-Reply-To: <20090911161645.GA13783@b07421-ec1.am.freescale.net>

Scott Wood wrote:
> On Thu, Sep 10, 2009 at 08:23:27PM -0400, Jerry Van Baren wrote:
>>    fdt set /ethernet at f00 interrupts "this is a string"
>> can now handle multiple strings (words) by concatenating them with 
>> spaces (quoted strings still work the same as before because of hush's 
>> argument parsing)
>>    fdt set /ethernet at f00 interrupts this is a string
> 
> How do you set a string list, then?
> 
> -Scott

Hi Scott,

That *is* a string, the two examples are equivalent.  The proposed 
parser change glues all the parameters together with a single space. 
The string parsing doesn't worry me because it is 100% backward 
compatible with the original parsing, e.g. these two commands will 
result in the same string being stored in the FDT:
   fdt set /ethernet at f00 interrupts "this is a string"
(one parameter with explicit spaces)
   fdt set /ethernet at f00 interrupts this is a string
(five parameters with implicit spaces).

If you want two spaces between words, you would have to use the 
explicitly quoted version:
   fdt set /ethernet at f00 interrupts "this  is  a  string"

Strings are backwards compatible because the hush parser strips the 
quotes so all that that part of Ken's patch does is to extend it to 
paste together multiple arguments rather than limiting it to exactly one 
argument.  The following also produces the original string:
   fdt set /ethernet at f00 interrupts "this is" "a string"

I'm more concerned with the [] form because that really is a syntax 
change.  The original syntax with a single quoted argument will no 
longer be parsed if I understand the change (I need to apply the patch 
and confirm this):
Old:
    fdt set /ethernet at f00 interrupts "[33 2 34 2 36 2]"
becomes
    fdt set /ethernet at f00 interrupts [ 33 2 34 2 36 2 ]
Note that the *must* be a space between "[" and "33" and between "2" and 
"]" because the "[" and "]" now have to be separate arguments.  This is 
what Andy did with "<" and ">" with no public outcry, so it is probably OK.

--------------------------------------------------------------
==== Does anybody have a problem with this syntax change? ====
--------------------------------------------------------------

If humans are typing the commands it shouldn't be a big deal.  If 
someone has those commands embedded in a script, their script will break 
and they will have to update it per the new syntax.

FWIIW, Andy's syntax is much cleaner than my original (must quote) 
syntax (other than the need for spaces between the "[" "]" "<" ">" 
symbols and the numbers, but I can accept that).

Best regards,
gvb

  reply	other threads:[~2009-09-11 16:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-10 21:41 [U-Boot] [PATCH] cmd_fdt.c: fix parse of byte streams and strings Ken MacLeod
2009-09-11  0:23 ` Jerry Van Baren
2009-09-11 16:16   ` Scott Wood
2009-09-11 16:30     ` Jerry Van Baren [this message]
2009-09-11 16:39       ` Scott Wood
2009-09-11 16:45         ` Andy Fleming
2009-09-11 16:51           ` Jerry Van Baren
2009-09-11 17:50       ` Ken MacLeod
2009-09-11 17:56         ` Scott Wood
2009-09-11 19:35         ` Jerry Van Baren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AAA7B41.3020505@ge.com \
    --to=gerald.vanbaren@ge.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox