PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/builtins/test.c

https://bitbucket.org/cyanogenmod/android_external_bash
C | 53 lines | 36 code | 12 blank | 5 comment | 5 complexity | 8031587f712425e040c4ac4285517551 MD5 | raw file
Possible License(s): GPL-3.0
  1. /* test.c, created from test.def. */
  2. #line 22 "./test.def"
  3. #line 98 "./test.def"
  4. #line 108 "./test.def"
  5. #include <config.h>
  6. #if defined (HAVE_UNISTD_H)
  7. # ifdef _MINIX
  8. # include <sys/types.h>
  9. # endif
  10. # include <unistd.h>
  11. #endif
  12. #include "../bashansi.h"
  13. #include "../bashintl.h"
  14. #include "../shell.h"
  15. #include "../test.h"
  16. #include "common.h"
  17. extern char *this_command_name;
  18. /* TEST/[ builtin. */
  19. int
  20. test_builtin (list)
  21. WORD_LIST *list;
  22. {
  23. char **argv;
  24. int argc, result;
  25. /* We let Matthew Bradburn and Kevin Braunsdorf's code do the
  26. actual test command. So turn the list of args into an array
  27. of strings, since that is what their code wants. */
  28. if (list == 0)
  29. {
  30. if (this_command_name[0] == '[' && !this_command_name[1])
  31. {
  32. builtin_error (_("missing `]'"));
  33. return (EX_BADUSAGE);
  34. }
  35. return (EXECUTION_FAILURE);
  36. }
  37. argv = make_builtin_argv (list, &argc);
  38. result = test_command (argc, argv);
  39. free ((char *)argv);
  40. return (result);
  41. }