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>
This commit is contained in:
Joe Hershberger 2012-12-11 22:16:22 -06:00 committed by Tom Rini
parent 7afcf3a55b
commit ec8a252cd4
16 changed files with 56 additions and 79 deletions

View file

@ -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);
}