80 if (!
array || !stringp) {
130 if (!strcasecmp(f->
name,
tmp->name)) {
147 struct _test_align {
void *
a, *
b; } p;
148 int align = (
char *)&p.b - (
char *)&p.a;
149 tmp->buf_size = ((f->
buf_size + align - 1) / align) * align;
152 memset(&
tmp->list, 0,
sizeof(
tmp->list));
156 ast_verb(5,
"Registered file format %s, extension(s) %s\n", f->
name, f->
exts);
169 if (!strcasecmp(
name,
tmp->name)) {
190 int pfd = mkstemp(template_name);
191 chmod(template_name, mode);
193 p = fdopen(pfd,
"w+");
206 if (
ast_asprintf(filename,
"%s/%s", path, template_name) < 0) {
213 if ((fd = mkstemp(*filename)) < 0) {
253 ast_debug(1,
"Opened video output file\n");
292 if ((res = fs->
fmt->
write(fs, trf))) {
306static int copy(
const char *infile,
const char *outfile)
311 if ((ifd = open(infile, O_RDONLY)) < 0) {
315 if ((ofd = open(outfile, O_WRONLY | O_TRUNC | O_CREAT,
AST_FILE_MODE)) < 0) {
320 while ( (
len = read(ifd,
buf,
sizeof(
buf)) ) ) {
327 res = write(ofd,
buf,
len);
355 if (!strcmp(
ext,
"wav49"))
358 if (filename[0] ==
'/') {
373static int type_in_list(
const char *list,
const char *
type,
int (*cmp)(
const char *s1,
const char *s2))
386#define exts_compare(list, type) (type_in_list((list), (type), strcmp))
440 if (
f->realfilename &&
f->filename) {
443 execl(
"/bin/mv",
"mv",
"-f",
f->filename,
f->realfilename,
SENTINEL);
483 s->
buf = (
char *)(s + 1);
558 char storage[strlen(f->
exts) + 1];
568 strcpy(storage, f->
exts);
570 while ( (
ext =
strsep(&stringp,
"|")) ) {
577 if ( stat(fn, &st) ) {
595 if ( (bfile = fopen(fn,
"r")) ==
NULL) {
610 if (st.st_size == 0) {
645 if ( (res = unlink(fn)) )
659 fn, nfn, strerror(
errno));
682 return strstr(
filename,
"://") ? 1 : 0;
714 snprintf(
buf + offset, buflen - offset,
"%s/%s", lang,
filename + offset);
767 if ((
end = strrchr(lang,
'_')) !=
NULL) {
796 const char *
filename,
const char *preflang,
int asis)
814 if (preflang ==
NULL)
816 buflen = strlen(preflang) + strlen(filename) + 4;
849 const char *
filename,
const char *preflang)
859 if (preflang ==
NULL) {
862 buflen = strlen(preflang) + strlen(filename) + 4;
919 if (!(fr = s->
fmt->
read(s, whennext))) {
982 rate = (
unsigned int)
roundf(samp_rate / ((
float) whennext));
1023 ast_debug(2,
"Failed to write frame\n");
1077 return fs->
fmt->
seek(fs, sample_offset, whence);
1134 if (preflang ==
NULL)
1136 buflen = strlen(preflang) + strlen(
filename) + 4;
1157 void *obj,
int max_depth)
1160 struct dirent *
entry;
1163 if (!(dir = opendir(path))) {
1165 path, strerror(
errno));
1178 if (!strcmp(
entry->d_name,
".") || !strcmp(
entry->d_name,
"..")) {
1187#ifdef _DIRENT_HAVE_D_TYPE
1188 if (
entry->d_type != DT_UNKNOWN &&
entry->d_type != DT_LNK) {
1189 is_file =
entry->d_type == DT_REG;
1190 is_dir =
entry->d_type == DT_DIR;
1194 struct stat statbuf;
1204 sprintf(full_path,
"%s/%s", path,
entry->d_name);
1206 if (stat(full_path, &statbuf)) {
1208 full_path, strerror(
errno));
1216 is_file = S_ISREG(statbuf.st_mode);
1217 is_dir = S_ISDIR(statbuf.st_mode);
1222 if ((res = on_file(path,
entry->d_name, obj))) {
1230 ast_debug(5,
"Skipping %s: not a regular file or directory\n", full_path);
1235 if (max_depth != 0) {
1242 sprintf(full_path,
"%s/%s", path,
entry->d_name);
1253 if (!res &&
errno) {
1255 path, strerror(
errno));
1262#if !defined(__GLIBC__)
1280#if !defined(__GLIBC__)
1286#if !defined(__GLIBC__)
1294 const char *preflang)
1301 char custom_filename[256];
1308 memset(custom_filename, 0,
sizeof(custom_filename));
1309 snprintf(custom_filename,
sizeof(custom_filename),
"custom/%s",
filename);
1312 tmp_filename = custom_filename;
1327 tmp_filename = (
char *)filename;
1333 pos = ftello(fs->
f);
1334 seekattempt = fseeko(fs->
f, -1, SEEK_END);
1336 if (
errno == EINVAL) {
1343 fseeko(fs->
f, pos, SEEK_SET);
1377 int format_found = 0;
1393 bfile = fopen(fn,
"r");
1425 int fd, myflags = 0;
1432 int format_found = 0;
1438 if (
flags & O_APPEND) {
1444 myflags |= O_WRONLY | O_CREAT;
1450 char *fn, *orig_fn =
NULL;
1466 bfile = fdopen(fd, ((
flags | myflags) & O_RDWR) ?
"w+" :
"w");
1483 for (
c = fn; *
c;
c++)
1497 bfile = fdopen(fd, ((
flags | myflags) & O_RDWR) ?
"w+" :
"w");
1552 f->seek(fs, 0, SEEK_END);
1553 }
else if (
errno != EEXIST) {
1599 cb(
c, ms_len,
type);
1614 const char *breakon,
1615 const char *forward,
1616 const char *reverse,
1673 if (!rchan && (outfd < 0) && (ms)) {
1680 }
else if (outfd > -1) {
1686 res = rchan ? 1 : 0;
1707 if (strchr(forward, res)) {
1709 }
else if (strchr(reverse, res)) {
1711 }
else if (strchr(breakon, res)) {
1799 const char *breakon,
1800 const char *forward,
1801 const char *reverse,
1806 -1 , -1 ,
NULL , cb);
1825 switch (return_value) {
1837 return return_value;
1899 char *stringp, *
type;
1901 int i, j, x,
first, found = 0;
1902 int len = strlen(fmts) + 1;
1930 for (i = 0; i < x; i++) {
1939 res = snprintf(fmts,
len,
"%s", fmts_str[i]);
1947 for (j = 0; j < i; j++) {
1949 if (fmts_ptr[j] == fmts_ptr[i]) {
1956 res = snprintf(fmts,
len,
"|%s", fmts_str[i]);
1972#define FORMAT "%-10s %-10s %-20s\n"
1973#define FORMAT2 "%-10s %-10s %-20s\n"
1979 e->
command =
"core show file formats";
1981 "Usage: core show file formats\n"
1982 " Displays currently registered file formats (if any).\n";
2000 ast_cli(
a->fd,
"%d file formats registered.\n", count_fmt);
2028 size_t item_len = strcspn(f->
exts,
"|");
2029 size_t bytes_written = snprintf(buffer, capacity,
".%.*s", (
int) item_len, f->
exts);
2030 if (bytes_written < capacity) {
Prototypes for public functions only of internal interest,.
struct sla_ringing_trunk * first
Asterisk main include file. File version handling, generic pbx functions.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
#define DEFAULT_SAMPLES_PER_MS
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_replace(dst, src)
Replace one object reference with another cleaning up the original.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
#define ao2_alloc(data_size, destructor_fn)
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
Clear a flag on a channel.
void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format)
#define ast_channel_lock(chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
void ast_channel_vstreamid_set(struct ast_channel *chan, int value)
struct ast_format * ast_channel_oldwriteformat(struct ast_channel *chan)
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
int ast_settimeout_full(struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data, unsigned int is_ao2_obj)
void ast_channel_streamid_set(struct ast_channel *chan, int value)
const char * ast_channel_context(const struct ast_channel *chan)
void ast_deactivate_generator(struct ast_channel *chan)
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
int ast_channel_timingfd(const struct ast_channel *chan)
void ast_channel_set_flag(struct ast_channel *chan, unsigned int flag)
Set a flag on a channel.
int ast_channel_vstreamid(const struct ast_channel *chan)
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
struct ast_filestream * ast_channel_vstream(const struct ast_channel *chan)
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
int ast_settimeout(struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data)
Enable or disable timer ticks for a channel.
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
struct ast_generator * ast_channel_generator(const struct ast_channel *chan)
const char * ast_channel_language(const struct ast_channel *chan)
int ast_channel_streamid(const struct ast_channel *chan)
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
#define ast_channel_unlock(chan)
void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value)
int ast_set_write_format_from_cap(struct ast_channel *chan, struct ast_format_cap *formats)
Sets write format on channel chan Set write format for channel to whichever component of "format" is ...
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
ast_media_type
Types of media.
off_t ast_tellstream(struct ast_filestream *fs)
Tell where we are in a stream.
static int filehelper(const char *filename, const void *arg2, const char *fmt, const enum file_action action)
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int cmdfd)
int ast_streamfile(struct ast_channel *chan, const char *filename, const char *preflang)
Streams a file.
int ast_file_fdtemp(const char *path, char **filename, const char *template_name)
Create a temporary file located at path.
struct ast_filestream * ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang)
Opens stream for use in seeking, playing.
struct ast_filestream * ast_openstream_full(struct ast_channel *chan, const char *filename, const char *preflang, int asis)
Opens stream for use in seeking, playing.
int ast_language_is_prefix
The following variable controls the layout of localized sound files. If 0, use the historical layout ...
struct ast_frame * ast_readframe(struct ast_filestream *s)
Read a frame from a filestream.
int ast_stopstream(struct ast_channel *tmp)
Stops a stream.
int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
Writes a frame to a stream.
int ast_seekstream(struct ast_filestream *fs, off_t sample_offset, int whence)
Seeks into stream.
static int ast_fsread_video(const void *data)
int ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int ms)
Same as waitstream but allows stream to be forwarded or rewound.
static char * handle_cli_core_show_file_formats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_format_def_unregister(const char *name)
Unregisters a file format.
static void file_shutdown(void)
int ast_stream_rewind(struct ast_filestream *fs, off_t ms)
Rewind stream ms.
static int sanitize_waitstream_return(int return_value)
int ast_applystream(struct ast_channel *chan, struct ast_filestream *s)
Applies a open stream to a channel.
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.
struct ast_filestream * ast_readfile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
Starts reading from a file.
struct ast_filestream * ast_openvstream(struct ast_channel *chan, const char *filename, const char *preflang)
Opens stream for use in seeking, playing.
static struct ast_json * json_array_from_list(const char *list, const char *sep)
FILE * ast_file_mkftemp(char *template_name, mode_t mode)
same as mkstemp, but return a FILE
static void filestream_destructor(void *arg)
struct ast_format * ast_get_format_for_file_ext(const char *file_ext)
Get the ast_format associated with the given file extension.
static char * build_filename(const char *filename, const char *ext)
construct a filename. Absolute pathnames are preserved, relative names are prefixed by the sounds/ di...
static void waitstream_control(struct ast_channel *c, enum ast_waitstream_fr_cb_values type, ast_waitstream_fr_cb cb, int skip_ms)
static int type_in_list(const char *list, const char *type, int(*cmp)(const char *s1, const char *s2))
int ast_filerename(const char *filename, const char *filename2, const char *fmt)
Renames a file.
struct ast_filestream * ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode)
Starts writing a file.
static void filestream_close(struct ast_filestream *f)
static int copy(const char *infile, const char *outfile)
int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
stream file until digit If the file name is non-empty, try to play it.
static int is_remote_path(const char *filename)
static int ast_fsread_audio(const void *data)
static ast_mutex_t read_dirs_lock
Lock to hold when iterating over directories.
static int __ast_file_read_dirs(const char *path, ast_file_on_file on_file, void *obj, int max_depth)
char * ast_format_str_reduce(char *fmts)
int ast_truncstream(struct ast_filestream *fs)
Trunc stream at current location.
static enum fsread_res ast_readaudio_callback(struct ast_filestream *s)
STASIS_MESSAGE_TYPE_DEFN(ast_format_register_type)
static int is_absolute_path(const char *filename)
int ast_ratestream(struct ast_filestream *fs)
Return the sample rate of the stream's format.
int ast_closestream(struct ast_filestream *f)
Closes a stream.
static int waitstream_core(struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int skip_ms, int audiofd, int cmdfd, const char *context, ast_waitstream_fr_cb cb)
the core of all waitstream() functions
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
static struct ast_cli_entry cli_file[]
static int open_wrapper(struct ast_filestream *s)
int ast_stream_fastforward(struct ast_filestream *fs, off_t ms)
Fast forward stream ms.
static int fn_wrapper(struct ast_filestream *s, const char *comment, enum wrap_fn mode)
static int fileexists_core(const char *filename, const char *fmt, const char *preflang, char *buf, int buflen, struct ast_format_cap *result_cap)
helper routine to locate a file with a given format and language preference.
static int rewrite_wrapper(struct ast_filestream *s, const char *comment)
static struct ast_filestream * get_filestream(struct ast_format_def *fmt, FILE *bfile)
static int fileexists_test(const char *filename, const char *fmt, const char *lang, char *buf, int buflen, struct ast_format_cap *result_cap)
test if a file exists for a given format.
int ast_get_extension_for_mime_type(const char *mime_type, char *buffer, size_t capacity)
Get a suitable filename extension for the given MIME type.
int ast_waitstream_fr_w_cb(struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int ms, ast_waitstream_fr_cb cb)
Same as waitstream_fr but allows a callback to be alerted when a user fastforwards or rewinds the fil...
int ast_playstream(struct ast_filestream *s)
Play a open stream on a channel.
#define exts_compare(list, type)
int ast_filedelete(const char *filename, const char *fmt)
Deletes a file.
static struct ast_frame * read_frame(struct ast_filestream *s, int *whennext)
static int publish_format_update(const struct ast_format_def *f, struct stasis_message_type *type)
int ast_waitstream_exten(struct ast_channel *c, const char *context)
Waits for a stream to stop or digit matching a valid one digit exten to be pressed.
int __ast_format_def_register(const struct ast_format_def *f, struct ast_module *mod)
Register a new file format capability. Adds a format to Asterisk's format abilities.
static enum fsread_res ast_readvideo_callback(struct ast_filestream *s)
int ast_filecopy(const char *filename, const char *filename2, const char *fmt)
Copies a file.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
ast_waitstream_fr_cb_values
@ AST_WAITSTREAM_CB_FASTFORWARD
@ AST_WAITSTREAM_CB_REWIND
@ AST_WAITSTREAM_CB_START
void() ast_waitstream_fr_cb(struct ast_channel *chan, long ms, enum ast_waitstream_fr_cb_values val)
callback used during dtmf controlled file playback to indicate location of playback in a file after r...
int(* ast_file_on_file)(const char *dir_name, const char *filename, void *obj)
Callback called for each file found when reading directories.
static int array(struct ast_channel *chan, const char *cmd, char *var, const char *value)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
int ast_safe_fork(int stop_reaper)
Common routine to safely fork without a chance of a signal handler firing badly in the child.
char * strsep(char **str, const char *delims)
#define ast_frisolate(fr)
Makes a frame independent of any static storage.
@ AST_CONTROL_STREAM_RESTART
@ AST_CONTROL_STREAM_SUSPEND
@ AST_CONTROL_STREAM_REVERSE
@ AST_CONTROL_REDIRECTING
@ AST_CONTROL_STREAM_STOP
@ AST_CONTROL_CONNECTED_LINE
@ AST_CONTROL_STREAM_FORWARD
@ AST_CONTROL_PVT_CAUSE_CODE
@ AST_CONTROL_UPDATE_RTP_PEER
#define ast_debug(level,...)
Log a DEBUG message.
#define VERBOSITY_ATLEAST(level)
#define ast_verb(level,...)
Asterisk JSON abstraction layer.
struct ast_json * ast_json_string_create(const char *value)
Construct a JSON string from value.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
int ast_json_array_append(struct ast_json *array, struct ast_json *value)
Append to an array.
struct ast_json_payload * ast_json_payload_create(struct ast_json *json)
Create an ao2 object to pass json blobs as data payloads for stasis.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct ast_json * ast_json_array_create(void)
Create a empty JSON array.
struct ast_json * ast_json_ref(struct ast_json *value)
Increase refcount on value.
A set of macros to manage forward-linked lists.
#define AST_RWLIST_REMOVE_CURRENT
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_RWLIST_TRAVERSE_SAFE_END
#define AST_RWLIST_TRAVERSE
#define AST_RWLIST_INSERT_HEAD
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Asterisk locking-related definitions:
#define ast_mutex_unlock(a)
#define SCOPED_RDLOCK(varname, lock)
scoped lock specialization for read locks
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
Asterisk module definitions.
#define ast_module_unref(mod)
Release a reference to the module.
#define ast_module_running_ref(mod)
Hold a reference to the module if it is running.
char record_cache_dir[AST_CACHE_DIR_LEN]
#define ast_opt_cache_record_files
#define ast_opt_sounds_search_custom
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_DATA_DIR
Core PBX routines and definitions.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
Scheduler Routines (derived from cheops)
#define AST_SCHED_DEL_ACCESSOR(sched, obj, getter, setter)
int ast_sched_add(struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result
Adds a scheduled event.
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
int ast_sched_wait(struct ast_sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
struct stasis_topic * ast_system_topic(void)
A Stasis Message Bus API topic which publishes messages regarding system changes.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_alloca(init_len)
Main Channel structure associated with a channel.
descriptor for a cli entry.
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
struct ast_filestream * vfs
struct ast_frame fr
frame produced by read, typically
struct ast_format_def * fmt
struct ast_channel * owner
struct ast_format * lastwriteformat
struct ast_trans_pvt * trans
const char * orig_chan_name
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
Abstract JSON element (object, array, string, int, ...).
Support for dynamic strings.
#define ast_test_suite_event_notify(s, f,...)
static struct aco_type item
Support for translation of data formats. translate.c.
struct ast_frame * ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, int consume)
translates one or more frames Apply an input frame into the translator and receive zero or one output...
void ast_translator_free_path(struct ast_trans_pvt *tr)
Frees a translator path Frees the given translator path structure.
struct ast_trans_pvt * ast_translator_build_path(struct ast_format *dest, struct ast_format *source)
Builds a translator path Build a path (possibly NULL) from source to dest.
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_mkdir(const char *path, int mode)
Recursively create directory path.