diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-12-11 22:16:22 -0600 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-12-13 11:46:55 -0700 |
commit | ec8a252cd492a7a409d6912aebeff34bb9e1e1e1 (patch) | |
tree | 346bb7bedd1dfe13f531725e7e0edaa2d80df1a8 /net | |
parent | 7afcf3a55b5f484b3d3442053fae8186a3fb92d7 (diff) |
env: Use getenv_yesno() more generally
Move the getenv_yesno() to env_common.c and change most checks for
'y' or 'n' to use this helper.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/net/net.c b/net/net.c index 82c4cc91179..da68a61d638 100644 --- a/net/net.c +++ b/net/net.c @@ -214,26 +214,24 @@ static int NetTryCount; */ void net_auto_load(void) { +#if defined(CONFIG_CMD_NFS) const char *s = getenv("autoload"); - if (s != NULL) { - if (*s == 'n') { - /* - * Just use BOOTP/RARP to configure system; - * Do not use TFTP to load the bootfile. - */ - net_set_state(NETLOOP_SUCCESS); - return; - } -#if defined(CONFIG_CMD_NFS) - if (strcmp(s, "NFS") == 0) { - /* - * Use NFS to load the bootfile. - */ - NfsStart(); - return; - } + if (s != NULL && strcmp(s, "NFS") == 0) { + /* + * Use NFS to load the bootfile. + */ + NfsStart(); + return; + } #endif + if (getenv_yesno("autoload") == 0) { + /* + * Just use BOOTP/RARP to configure system; + * Do not use TFTP to load the bootfile. + */ + net_set_state(NETLOOP_SUCCESS); + return; } TftpStart(TFTPGET); } |