svn commit: trunk/busybox/coreutils

aldot at busybox.net aldot at busybox.net
Fri Jun 15 03:36:51 PDT 2007


Author: aldot
Date: 2007-06-15 03:36:49 -0700 (Fri, 15 Jun 2007)
New Revision: 18825

Log:
- fix test -f ./exists
  Note that test -f ./exists -a "-u" = "-u" doesn't work and did not work even before r18282, so this is a breakage not caused by me..


Modified:
   trunk/busybox/coreutils/test.c


Changeset:
Modified: trunk/busybox/coreutils/test.c
===================================================================
--- trunk/busybox/coreutils/test.c	2007-06-15 08:30:33 UTC (rev 18824)
+++ trunk/busybox/coreutils/test.c	2007-06-15 10:36:49 UTC (rev 18825)
@@ -183,6 +183,7 @@
 {
 	int res;
 	char *arg0;
+	bool _off;
 
 	arg0 = strrchr(argv[0], '/');
 	if (!arg0++) arg0 = argv[0];
@@ -224,15 +225,19 @@
 	if (argc == 2)
 		return *argv[1] == '\0';
 //assert(argc);
+	/* remember if we saw argc==4 which wants *no* '!' test */
+	_off = argc - 4;
+	if (_off ?
+		(LONE_CHAR(argv[1], '!'))
+		: (argv[1][0] != '!' || argv[1][1] != '\0'))
 	{
-		bool _off;
 		if (argc == 3)
 			return *argv[2] != '\0';
-		_off = argc - 4;
+
 		t_lex(argv[2 + _off]);
 		if (t_wp_op && t_wp_op->op_type == BINOP) {
 			t_wp = &argv[1 + _off];
-			return binop() == (LONE_CHAR(argv[1], '!'));
+			return binop() == _off;
 		}
 	}
 	t_wp = &argv[1];



More information about the busybox-cvs mailing list