Re: [PATCH] commands: add 'findstr' to get string from file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux