summaryrefslogtreecommitdiff
path: root/common/cmd_itest.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-02-08 16:56:05 +0100
committerWolfgang Denk <wd@denx.de>2011-02-15 21:45:55 +0100
commitcc22b795fb5fee72bd567eec5d33a11e8b989086 (patch)
tree6d23882891ce53279ddaa5f7989362d37bdd7764 /common/cmd_itest.c
parent518075fc6ae8a4420b937009130e70cfdb7083b8 (diff)
downloadu-boot-imx-cc22b795fb5fee72bd567eec5d33a11e8b989086.zip
u-boot-imx-cc22b795fb5fee72bd567eec5d33a11e8b989086.tar.gz
u-boot-imx-cc22b795fb5fee72bd567eec5d33a11e8b989086.tar.bz2
itest: fix result of string compares
The implementation of the string compare function of the "itest" command was weird, as only the length of the shortest argument was included in the compare, with the result that something like "itest.s abd == abddef" would return TRUE. Fix this. Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
Diffstat (limited to 'common/cmd_itest.c')
-rw-r--r--common/cmd_itest.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index fa6a0c3..2a238a4 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -94,16 +94,13 @@ static char * evalstr(char *s)
static int stringcomp(char *s, char *t, int op)
{
- int n, p;
+ int p;
char *l, *r;
l = evalstr(s);
r = evalstr(t);
- /* we'll do a compare based on the length of the shortest string */
- n = min(strlen(l), strlen(r));
-
- p = strncmp(l, r, n);
+ p = strcmp(l, r);
switch (op) {
case EQ: return (p == 0);
case NE: return (p != 0);