From: Peter Tyser <ptyser@xes-inc.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4] common: add a grepenv command
Date: Tue, 05 Apr 2011 10:00:52 -0500 [thread overview]
Message-ID: <1302015652.24947.27338.camel@petert> (raw)
In-Reply-To: <20110404201829.82dbf9c7.kim.phillips@freescale.com>
Hi Kim,
> +#ifdef CONFIG_CMD_GREPENV
> +static int do_env_grep (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> +{
> + ENTRY *match;
> + int matched[env_htab.size];
> + int rcode = 1, idx;
> +
> + if (argc < 2) {
> + cmd_usage(cmdtp);
> + return 1;
> + }
This could be:
if (argc < 2)
return cmd_usage(cmdtp);
> + for (idx = 0; idx < env_htab.size; idx++)
> + matched[idx] = 0;
memset()?
<snip>
> +#ifdef CONFIG_CMD_GREPENV
> +U_BOOT_CMD_COMPLETE(
> + grepenv, CONFIG_SYS_MAXARGS, 0, do_env_grep,
> + "search environment variables",
> + "string ...\n"
> + " - list environment name=value pairs matching 'string'",
> + var_complete
> +);
> +#endif
Support for "env grep" should also be added to the "env" command in
cmd_nvedit.c. My understanding was that the individual printenv,
setenv, etc commands were deprecated in favor of the unified "env"
command.
Cool feature!
Peter
next prev parent reply other threads:[~2011-04-05 15:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 22:46 [U-Boot] [PATCH v2] common: add a grepenv command Kim Phillips
2011-04-01 22:59 ` Wolfgang Denk
2011-04-01 23:06 ` Mike Frysinger
2011-04-04 19:45 ` [U-Boot] [PATCH v3] " Kim Phillips
2011-04-04 20:57 ` Wolfgang Denk
2011-04-05 1:18 ` [U-Boot] [PATCH v4] " Kim Phillips
2011-04-05 15:00 ` Peter Tyser [this message]
2011-04-05 15:46 ` Mike Frysinger
2011-04-05 17:15 ` [U-Boot] [PATCH v5] " Kim Phillips
2011-04-27 22:57 ` Wolfgang Denk
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=1302015652.24947.27338.camel@petert \
--to=ptyser@xes-inc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.