1
2 #include "cs_config.h"
3 #include <stdio.h>
4 #include "util/neo_misc.h"
5 #include "util/neo_err.h"
6 #include "util/ulist.h"
7 #include "util/neo_files.h"
8
main(int argc,char ** argv)9 int main(int argc, char **argv)
10 {
11 char *path;
12 ULIST *files = NULL;
13 char *filename;
14 NEOERR *err;
15 int x;
16
17 if (argc > 1)
18 path = argv[1];
19 else
20 path = ".";
21
22 ne_warn("Testing ne_listdir()");
23 err = ne_listdir(path, &files);
24 if (err)
25 {
26 nerr_log_error(err);
27 return -1;
28 }
29
30 for (x = 0; x < uListLength(files); x++)
31 {
32 err = uListGet(files, x, (void *)&filename);
33 printf("%s\n", filename);
34 }
35
36 uListDestroy(&files, ULIST_FREE);
37
38 ne_warn("Testing ne_listdir_match() with *.c");
39 err = ne_listdir_match(path, &files, "*.c");
40 if (err)
41 {
42 nerr_log_error(err);
43 return -1;
44 }
45
46 for (x = 0; x < uListLength(files); x++)
47 {
48 err = uListGet(files, x, (void *)&filename);
49 printf("%s\n", filename);
50 }
51
52 uListDestroy(&files, ULIST_FREE);
53 return 0;
54 }
55