opnsense-ports/sysutils/u-boot-wandboard/files/patch-common_cmd__test.c
Franco Fichtner 8c34d21606 */*: bring in previously unknown upstream stuff
Taken from: FreeBSD
2015-04-22 06:26:02 +02:00

19 lines
470 B
C

--- common/cmd_test.c.orig 2014-08-14 14:51:10 UTC
+++ common/cmd_test.c
@@ -22,9 +22,14 @@ static int do_test(cmd_tbl_t *cmdtp, int
char * const *ap;
int left, adv, expr, last_expr, neg, last_cmp;
- /* args? */
- if (argc < 3)
+ /*
+ * If no args, that's bogus, return false.
+ * If op is -z and no other args, answer is Yes, string is empty.
+ */
+ if (argc < 2)
return 1;
+ else if (argc == 2)
+ return !(strcmp(argv[1], "-z") == 0);
#ifdef DEBUG
{