blob: 83ccde8796dcdc36e2c6fd3cc70cd8ff86290a85 [file] [log] [blame]
Dan Pasanenc6e37862014-10-02 14:08:59 -05001/* test.c, created from test.def. */
2#line 22 "./test.def"
3
4#line 103 "./test.def"
5
6#line 113 "./test.def"
7
8#include <config.h>
9
10#if defined (HAVE_UNISTD_H)
11# ifdef _MINIX
12# include <sys/types.h>
13# endif
14# include <unistd.h>
15#endif
16
17#include "../bashansi.h"
18#include "../bashintl.h"
19
20#include "../shell.h"
21#include "../test.h"
22#include "common.h"
23
24extern char *this_command_name;
25
26/* TEST/[ builtin. */
27int
28test_builtin (list)
29 WORD_LIST *list;
30{
31 char **argv;
32 int argc, result;
33
34 /* We let Matthew Bradburn and Kevin Braunsdorf's code do the
35 actual test command. So turn the list of args into an array
36 of strings, since that is what their code wants. */
37 if (list == 0)
38 {
39 if (this_command_name[0] == '[' && !this_command_name[1])
40 {
41 builtin_error (_("missing `]'"));
42 return (EX_BADUSAGE);
43 }
44
45 return (EXECUTION_FAILURE);
46 }
47
48 argv = make_builtin_argv (list, &argc);
49 result = test_command (argc, argv);
50 free ((char *)argv);
51
52 return (result);
53}