From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 03/13] common: add run_command2 for running simple or hush commands
Date: Tue, 23 Aug 2011 17:46:56 -0400 [thread overview]
Message-ID: <201108231746.57132.vapier@gentoo.org> (raw)
In-Reply-To: <1314133621-6488-4-git-send-email-jason.hobbs@calxeda.com>
On Tuesday, August 23, 2011 17:06:51 Jason Hobbs wrote:
> Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
> ---
> changes in v2:
> - whitespace correction
>
> changes in v4:
> - fix indention of a run_command2 line
> - make run_command2 static inline
>
> common/hush.c | 2 +-
> common/main.c | 50 +++++++++++++++++++++-----------------------------
> include/hush.h | 2 +-
> 3 files changed, 23 insertions(+), 31 deletions(-)
>
> diff --git a/common/hush.c b/common/hush.c
> index 85a6030..940889b 100644
> --- a/common/hush.c
> +++ b/common/hush.c
> @@ -3217,7 +3217,7 @@ int parse_stream_outer(struct in_str *inp, int flag)
> #ifndef __U_BOOT__
> static int parse_string_outer(const char *s, int flag)
> #else
> -int parse_string_outer(char *s, int flag)
> +int parse_string_outer(const char *s, int flag)
> #endif /* __U_BOOT__ */
> {
> struct in_str input;
> diff --git a/common/main.c b/common/main.c
> index b97d89e..e9e8350 100644
> --- a/common/main.c
> +++ b/common/main.c
> @@ -83,8 +83,7 @@ extern void mdm_init(void); /* defined in board.c */
>
> /*************************************************************************
> ** * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
> - * returns: 0 - no key string, allow autoboot
> - * 1 - got key string, abort
> + * returns: 0 - no key string, allow autoboot 1 - got key string, abort
> */
> #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
> # if defined(CONFIG_AUTOBOOT_KEYED)
> @@ -266,6 +265,20 @@ int abortboot(int bootdelay)
> # endif /* CONFIG_AUTOBOOT_KEYED */
> #endif /* CONFIG_BOOTDELAY >= 0 */
>
> +static inline
> +int run_command2(const char *cmd, int flag)
> +{
> +#ifndef CONFIG_SYS_HUSH_PARSER
> + if (run_command(cmd, flag) == -1)
> + return 1;
> +#else
> + if (parse_string_outer(cmd,
> + FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
> + return 1;
> +#endif
> + return 0;
> +}
do you need to do your own return value munging ? seems like "returns 0 on
success, non-zero on failure" would allow you to do:
{
#ifndef CONFIG_SYS_HUSH_PARSER
return run_command(cmd, flag);
#else
return parse_string_outer(cmd,
FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP);
#endif
}
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110823/e0487afe/attachment.pgp
next prev parent reply other threads:[~2011-08-23 21:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-23 21:06 [U-Boot] [PATCH v4 00/13] Add PXE support Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 01/13] Add generic, reusable menu code Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 02/13] common, menu: use abortboot for menu timeout Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 03/13] common: add run_command2 for running simple or hush commands Jason Hobbs
2011-08-23 21:46 ` Mike Frysinger [this message]
2011-08-23 21:06 ` [U-Boot] [PATCH v4 04/13] Add isblank Jason Hobbs
2011-08-23 21:40 ` Mike Frysinger
2011-08-24 15:40 ` Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 05/13] cosmetic: remove unneeded curly braces Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 06/13] Replace space and tab checks with isblank Jason Hobbs
2011-08-23 21:42 ` Mike Frysinger
2011-08-24 15:56 ` Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 07/13] Add standard environment variables README Jason Hobbs
2011-08-23 21:45 ` Mike Frysinger
2011-08-24 16:29 ` Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 08/13] lib: add uuid_str_to_bin for use with bootp and PXE uuid Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 09/13] Add pxe command Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 10/13] net: bootp: add PXE/RFC 4578 DHCP options support Jason Hobbs
2011-08-23 21:06 ` [U-Boot] [PATCH v4 11/13] Convert ca9x4_ct_vxp to standard env variables Jason Hobbs
2011-08-23 21:07 ` [U-Boot] [PATCH v4 12/13] arm: ca9x4_ct_vxp: enable pxe command support Jason Hobbs
2011-08-23 21:07 ` [U-Boot] [PATCH v4 13/13] arm: ca9x4_ct_vxp: enable PXE BOOTP options support Jason Hobbs
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=201108231746.57132.vapier@gentoo.org \
--to=vapier@gentoo.org \
--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