From f759ad3196a5f09d50c677167492448162ad4d4e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 11 Aug 2018 10:47:46 -0600 Subject: [PATCH] Backs out most of commit 093391fcff414b08e8f91d949edb896614eb2347. I was confused. I re-emplemented a feature that already existed. Silly me. --- nshlib/README.txt | 2 +- nshlib/nsh_test.c | 24 ++++-------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/nshlib/README.txt b/nshlib/README.txt index a91f94961..1bd382e82 100644 --- a/nshlib/README.txt +++ b/nshlib/README.txt @@ -268,7 +268,7 @@ file system image. Simple Commands ^^^^^^^^^^^^^^^ -o [ [!] ] +o [ ] o test These are two alternative forms of the same command. They support diff --git a/nshlib/nsh_test.c b/nshlib/nsh_test.c index 98405adde..8b4b310c8 100644 --- a/nshlib/nsh_test.c +++ b/nshlib/nsh_test.c @@ -442,28 +442,12 @@ int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) nsh_output(vtbl, g_fmtsyntax, argv[0]); return ERROR; } - else - { - bool inverted = false; - int index = 1; - int result; - /* Check if the expression is inverted */ + /* Then perform the test on the arguments enclosed by the left and right + * brackets. + */ - if (strcmp(argv[index], "!") == 0) - { - index++; - inverted = true; - } - - result = expression(vtbl, argc - index - 1, &argv[index]); - if (inverted && result != TEST_ERROR) - { - result = (result == TEST_TRUE ? TEST_FALSE : TEST_TRUE); - } - - return result; - } + return expression(vtbl, argc - 2, &argv[1]); } #endif /* !CONFIG_NSH_DISABLESCRIPT && !CONFIG_NSH_DISABLE_TEST */