]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - common/cmd_itest.c
cmd_i2c.c: reworked subcommand handling
[people/ms/u-boot.git] / common / cmd_itest.c
index 309b08bb03a5121adae34dfd825c16e1c772c4ab..58c5e7b3b56d4a83d5757998520870c8efebf762 100644 (file)
@@ -66,12 +66,17 @@ op_tbl_t op_table [] = {
 
 static long evalexp(char *s, int w)
 {
-       long l, *p;
+       long l = 0;
+       long *p;
 
        /* if the parameter starts with a * then assume is a pointer to the value we want */
        if (s[0] == '*') {
                p = (long *)simple_strtoul(&s[1], NULL, 16);
-               l = *p;
+               switch (w) {
+               case 1: return((long)(*(unsigned char *)p));
+               case 2: return((long)(*(unsigned short *)p));
+               case 4: return(*p);
+               }
        } else {
                l = simple_strtoul(s, NULL, 16);
        }
@@ -191,5 +196,5 @@ int do_itest ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] )
 U_BOOT_CMD(
        itest, 4, 0, do_itest,
        "return true/false on integer compare",
-       "[.b, .w, .l, .s] [*]value1 <op> [*]value2\n"
+       "[.b, .w, .l, .s] [*]value1 <op> [*]value2"
 );