Skip to contentSkip to conversation

test command bug.

PATCH New Hiroshi Ito 2 participants 2 messages Nov 26, 2004 – Apr 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test command bug.

Hello, I'm new to this list.

u-boot-1.1.2 ( cvs version )

# if test -z "" ; then echo true; else echo false; fi
false
# if test -n "" ; then echo true; else echo false; fi
true
#

The logic is reversed.

patch is attached.
--------
Hiroshi Ito
Media Lab. Inc.,
URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256 -------------- next part --------------
Index: common/command.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/common/command.c,v retrieving revision 1.17

command.c +2 -2
diff -u -b -B -w -p -r1.17 command.c
@@ -136,9 +136,9 @@ do_test (cmd_tbl_t *cmdtp, int flag, int
 
 		if (adv == 2) {
 			if (strcmp(ap[0], "-z") == 0)
-				expr = strlen(ap[1]) == 0 ? 0 : 1;
-			else if (strcmp(ap[0], "-n") == 0)
 				expr = strlen(ap[1]) == 0 ? 1 : 0;
+			else if (strcmp(ap[0], "-n") == 0)
+				expr = strlen(ap[1]) == 0 ? 0 : 1;
 			else {
 				expr = 1;
 				break;
#1 lore raw

PATCH 1/1 test command bug.

Quoted 10 lines · In message <[email protected]> you wrote:

Hello, I'm new to this list.

u-boot-1.1.2 ( cvs version )

# if test -z "" ; then echo true; else echo false; fi
false
# if test -n "" ; then echo true; else echo false; fi
true
#
Quoted 3 lines

The logic is reversed.

patch is attached.

Good introduction :-) Thanks, added. [Sorry it took so long.]

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The idea of male and female are universal constants.
	-- Kirk, "Metamorphosis", stardate 3219.8