*
* Copyright (c) by a whole pile of folks:
*
- * test(1); version 7-like -- author Erik Baalbergen
- * modified by Eric Gisin to be used as built-in.
- * modified by Arnold Robbins to add SVR3 compatibility
- * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket).
- * modified by J.T. Conklin for NetBSD.
- * modified by Herbert Xu to be used as built-in in ash.
- * modified by Erik Andersen <andersen@codepoet.org> to be used
- * in busybox.
+ * test(1); version 7-like -- author Erik Baalbergen
+ * modified by Eric Gisin to be used as built-in.
+ * modified by Arnold Robbins to add SVR3 compatibility
+ * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket).
+ * modified by J.T. Conklin for NetBSD.
+ * modified by Herbert Xu to be used as built-in in ash.
+ * modified by Erik Andersen <andersen@codepoet.org> to be used
+ * in busybox.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Original copyright notice states:
- * "This program is in the Public Domain."
+ * "This program is in the Public Domain."
*/
#include <sys/types.h>
unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"|
"-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
- binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
+ binary-operator ::= "="|"=="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
"-nt"|"-ot"|"-ef";
operand ::= <any legal UNIX file name>
*/
"-L", FILSYM, UNOP}, {
"-S", FILSOCK, UNOP}, {
"=", STREQ, BINOP}, {
+ "==", STREQ, BINOP}, {
"!=", STRNE, BINOP}, {
"<", STRLT, BINOP}, {
">", STRGT, BINOP}, {
static int is_a_group_member(gid_t gid);
static void initialize_group_array(void);
-extern int test_main(int argc, char **argv)
+int test_main(int argc, char **argv)
{
int res;
bb_error_msg_and_die("missing ]");
argv[argc] = NULL;
}
+ if (strcmp(bb_applet_name, "[[") == 0) {
+ if (strcmp(argv[--argc], "]]"))
+ bb_error_msg_and_die("missing ]]");
+ argv[argc] = NULL;
+ }
/* Implement special cases from POSIX.2, section 4.62.4 */
switch (argc) {
case 1:
return strlen(*t_wp) > 0;
}
-static int binop()
+static int binop(void)
{
const char *opnd1, *opnd2;
struct t_op const *op;
return (-1);
}
-static void initialize_group_array()
+static void initialize_group_array(void)
{
ngroups = getgroups(0, NULL);
group_array = xrealloc(group_array, ngroups * sizeof(gid_t));