Dear Kim Phillips, In message <20110401174658.eaa8d773.kim.phill...@freescale.com> you wrote: > u-boot environments, esp. when boards are shared across multiple > users, can get pretty large and time consuming to visually parse. > The grepenv command this patch adds can be used in lieu of printenv > to facilitate searching. grepenv works like printenv but limits > its output only to environment strings (variable name and value > pairs) that match the user specified substring.
It would be nice if you gave an example of how to use this. > +int do_grepenv (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > +{ > + char buf[CONFIG_SYS_CBSIZE], *searchstr; > + int i = 0, j = 0, k = 0; > + int rcode = 1; > + > + if (argc != 2) { > + cmd_usage(cmdtp); > + return 1; > + } Why don't you allow for an arbitrary number of arguments here? > + /* find and print matching env vars */ > + do { > + buf[j] = env_get_char(i); ... > + } while (!(j == 0 && env_get_char(i) == '\0')); This does not work as you might expect. The current environment cannot be parsed like that, becuase it is not stored in a linear list any more, but in a hash table instead. You may be lucky on some systems (especially NOR flash based ones) to read the last saved data from the persistent storage, but this is NOT the current environment. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de "Deliver yesterday, code today, think tomorrow." _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot