59    if ((res = rmdir(dir_name)) < 0) {
 
 
   82    for (i = 0; i < num; ++i) {
 
 
  122    char *full_path = 
ast_alloca(strlen(dir_name) + strlen(filename) + 2);
 
  124    sprintf(full_path, 
"%s/%s", dir_name, filename);
 
  127    if (stat(full_path, &statbuf)) {
 
  129            full_path, strerror(
errno));
 
  133    return strcmp(obj, filename) ? 0 : 
FOUND;
 
 
  138    char tmp_dir[] = 
"/tmp/tmpdir.XXXXXX";
 
  142    const int num_files = 10 + (
ast_random() % 10); 
 
  146        info->name = 
"read_dir_test";
 
  147        info->category = 
"/main/file/";
 
  148        info->summary = 
"Read a directory's content";
 
  149        info->description = 
"Iterate over directories looking for a file.";
 
  165    ast_str_set(&tmp_sub_dir, 0, 
"%s/XXXXXX", tmp_dir);
 
 
char * mkdtemp(char *template_s)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_file_read_dirs(const char *dir_name, ast_file_on_file on_file, void *obj, int max_depth)
Recursively iterate through files and directories up to max_depth.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Asterisk file paths, configured in asterisk.conf.
String manipulation functions.
#define ast_str_alloca(init_len)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Support for dynamic strings.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
#define AST_TEST_DEFINE(hdr)
static int test_files_destroy(struct ast_test *test, char *dir_name, struct _filenames *filenames)
static char * test_files_get_one(struct _filenames *filenames, int num)
static int test_files_create(struct ast_test *test, char *dir_name, struct _filenames *filenames, int num)
static int handle_find_file(const char *dir_name, const char *filename, void *obj)
static int load_module(void)
static int unload_module(void)
static void rm_file(struct ast_str *filename)
long int ast_random(void)
Vector container support.
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.
#define AST_VECTOR(name, type)
Define a vector structure.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.