Merged in bkueng/nuttx-apps (pull request #138)
nsh_parse.c: fix 'while' and 'until' loop condition The loop condition logic was inverted: while true; do echo "test"; done would exit immediately, while using 'until' would stay in the loop. This is the opposite of how it is supposed to work. The reason is that 'state' was set wrong because 'whilematch' is a bool. Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
0123480851
commit
c6697c150d
@ -1552,7 +1552,7 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
||||
|
||||
/* "Push" the old state and set the new state */
|
||||
|
||||
state = whilematch == 0 ? NSH_LOOP_WHILE : NSH_LOOP_UNTIL;
|
||||
state = whilematch ? NSH_LOOP_WHILE : NSH_LOOP_UNTIL;
|
||||
enable = nsh_cmdenabled(vtbl);
|
||||
#ifdef NSH_DISABLE_SEMICOLON
|
||||
offset = np->np_foffs;
|
||||
|
Loading…
Reference in New Issue
Block a user