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