mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Christoph Fritz <chf.fritz@googlemail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] commands: add 'findstr' to get string from file
Date: Wed, 21 May 2014 15:51:01 +0200	[thread overview]
Message-ID: <20140521135101.GM5858@pengutronix.de> (raw)
In-Reply-To: <1400606875.26128.1.camel@mars>

Hi Christoph,

On Tue, May 20, 2014 at 07:27:55PM +0200, Christoph Fritz wrote:
> Command 'findstr' can be for example used to find the string
> "MAC=1C:BA:8C:F3:82:BB" in file /dev/eeprom0 to set the
> appropriate variable:
> 
>  $ findstr -o 4 -l 17 -t eth0.ethaddr MAC /dev/eeprom0
> 
> Usage: findstr [OPTIONS] <STRING> <FILE>
> Find string in file and print it
> -o <offset>     set offset of string which gets printed
> -l <length>     set length of string which gets printed
> -t <var>        print into variable instead of stdio

I wonder how useful such a command is. I mean normally I would
expect a MAC address to be stored in binary format and not ASCII.
Matching 'MAC' (what about the '='?) seems not very robust. What about
strings with dynamic lengths?
If the command is primarily intended for the MAC address then maybe
a more dedicated command or a piece of code called from board code
is more robust. If the command is intended as a general
eeprom-variable-store then I think it's not flexible enough.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-05-21 13:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 17:27 Christoph Fritz
2014-05-20 18:08 ` Alexander Aring
2014-05-20 20:29   ` Christoph Fritz
2014-05-21  3:44     ` Alexander Aring
2014-05-21  8:02       ` [PATCH v2] commands: add 'findstr' to search file for string Christoph Fritz
2014-05-21  9:22         ` Antony Pavlov
2014-05-21  9:49           ` Christoph Fritz
2014-05-21 13:51 ` Sascha Hauer [this message]
2014-05-22  9:20   ` [PATCH] commands: add 'findstr' to get string from file Christoph Fritz

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=20140521135101.GM5858@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=chf.fritz@googlemail.com \
    /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