lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #include <glob.h> |
| 2 | #include <stdio.h> |
| 3 | #include <string.h> |
| 4 | |
| 5 | static int |
| 6 | do_test (void) |
| 7 | { |
| 8 | int result = 0; |
| 9 | glob_t g; |
| 10 | g.gl_pathc = 0; |
| 11 | |
| 12 | int r = glob ("", 0, NULL, &g); |
| 13 | if (r != GLOB_NOMATCH) |
| 14 | { |
| 15 | puts ("glob (\"\", 0, NULL, &g) did not fail"); |
| 16 | result = 1; |
| 17 | } |
| 18 | else if (g.gl_pathc != 0) |
| 19 | { |
| 20 | puts ("gl_pathc after glob (\"\", 0, NULL, &g) not zero"); |
| 21 | result = 1; |
| 22 | } |
| 23 | |
| 24 | r = glob ("", GLOB_NOCHECK, NULL, &g); |
| 25 | if (r != 0) |
| 26 | { |
| 27 | puts ("glob (\"\", GLOB_NOCHECK, NULL, &g) did fail"); |
| 28 | result = 1; |
| 29 | } |
| 30 | else if (g.gl_pathc != 1) |
| 31 | { |
| 32 | puts ("gl_pathc after glob (\"\", GLOB_NOCHECK, NULL, &g) not 1"); |
| 33 | result = 1; |
| 34 | } |
| 35 | else if (strcmp (g.gl_pathv[0], "") != 0) |
| 36 | { |
| 37 | puts ("gl_pathv[0] after glob (\"\", GLOB_NOCHECK, NULL, &g) not \"\""); |
| 38 | result = 1; |
| 39 | } |
| 40 | |
| 41 | return result; |
| 42 | } |
| 43 | |
| 44 | #define TEST_FUNCTION do_test () |
| 45 | #include "../test-skeleton.c" |