mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-20 21:41:18 +08:00
apps/nshlib: Back out 516a743344
. While the change is fuly functional and adds a pleasing symmetry to the control commands, it is also redundant and serves no real purpose other than requiring more FLASH.
This commit is contained in:
@@ -439,8 +439,6 @@ static int nsh_saveresult(FAR struct nsh_vtbl_s *vtbl, bool result)
|
||||
|
||||
if (np->np_lpstate[np->np_lpndx].lp_state == NSH_LOOP_WHILE)
|
||||
{
|
||||
result ^= np->np_lpstate[np->np_lpndx].lp_inverted;
|
||||
|
||||
np->np_fail = false;
|
||||
np->np_lpstate[np->np_lpndx].lp_enable = (result == OK);
|
||||
return OK;
|
||||
@@ -457,8 +455,6 @@ static int nsh_saveresult(FAR struct nsh_vtbl_s *vtbl, bool result)
|
||||
|
||||
else if (np->np_lpstate[np->np_lpndx].lp_state == NSH_LOOP_UNTIL)
|
||||
{
|
||||
result ^= np->np_lpstate[np->np_lpndx].lp_inverted;
|
||||
|
||||
np->np_fail = false;
|
||||
np->np_lpstate[np->np_lpndx].lp_enable = (result != OK);
|
||||
return OK;
|
||||
@@ -1774,7 +1770,6 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
||||
bool whilematch;
|
||||
bool untilmatch;
|
||||
bool enable;
|
||||
bool inverted = false;
|
||||
int ret;
|
||||
|
||||
if (cmd != NULL)
|
||||
@@ -1797,22 +1792,6 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Check for inverted logic */
|
||||
|
||||
if (strcmp(*ppcmd, "!") == 0)
|
||||
{
|
||||
inverted = true;
|
||||
|
||||
/* Get the next cmd */
|
||||
|
||||
*ppcmd = nsh_argument(vtbl, saveptr, memlist);
|
||||
if (*ppcmd == NULL || **ppcmd == '\0')
|
||||
{
|
||||
nsh_output(vtbl, g_fmtarginvalid, cmd);
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
/* Verify that "while" or "until" is valid in this context */
|
||||
|
||||
if (
|
||||
@@ -1849,13 +1828,12 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
||||
np->np_jump = false;
|
||||
#endif
|
||||
np->np_lpndx++;
|
||||
np->np_lpstate[np->np_lpndx].lp_state = state;
|
||||
np->np_lpstate[np->np_lpndx].lp_enable = enable;
|
||||
np->np_lpstate[np->np_lpndx].lp_inverted = inverted;
|
||||
np->np_lpstate[np->np_lpndx].lp_state = state;
|
||||
np->np_lpstate[np->np_lpndx].lp_enable = enable;
|
||||
#ifndef CONFIG_NSH_DISABLE_ITEF
|
||||
np->np_lpstate[np->np_lpndx].lp_iendx = np->np_iendx;
|
||||
np->np_lpstate[np->np_lpndx].lp_iendx = np->np_iendx;
|
||||
#endif
|
||||
np->np_lpstate[np->np_lpndx].lp_topoffs = offset;
|
||||
np->np_lpstate[np->np_lpndx].lp_topoffs = offset;
|
||||
}
|
||||
|
||||
/* Check if the token is "do" */
|
||||
@@ -1959,13 +1937,12 @@ static int nsh_loop(FAR struct nsh_vtbl_s *vtbl, FAR char **ppcmd,
|
||||
|
||||
errout:
|
||||
#ifndef NSH_DISABLE_SEMICOLON
|
||||
np->np_jump = false;
|
||||
np->np_jump = false;
|
||||
#endif
|
||||
np->np_lpndx = 0;
|
||||
np->np_lpstate[0].lp_state = NSH_LOOP_NORMAL;
|
||||
np->np_lpstate[0].lp_enable = true;
|
||||
np->np_lpstate[0].lp_inverted = false;
|
||||
np->np_lpstate[0].lp_topoffs = 0;
|
||||
np->np_lpndx = 0;
|
||||
np->np_lpstate[0].lp_state = NSH_LOOP_NORMAL;
|
||||
np->np_lpstate[0].lp_enable = true;
|
||||
np->np_lpstate[0].lp_topoffs = 0;
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user