libexplain
1.4.D001
|
#include <libexplain/ac/errno.h>
#include <libexplain/ac/stdio.h>
#include <libexplain/ac/stdlib.h>
#include <libexplain/ac/string.h>
#include <libexplain/ac/sys/stat.h>
#include <libexplain/path_search.h>
#include <libexplain/program_name.h>
#include <libexplain/buffer/eexist.h>
#include <libexplain/buffer/software_error.h>
Go to the source code of this file.
Functions | |
static int | direxists (const char *pathname) |
int | explain_path_search (char *pathname, size_t pathname_size, const char *dir, const char *prefix, int try_tmpdir) |
static void | paths_push (const char **paths, size_t *paths_count, const char *path) |
int | explain_path_search_explanation (explain_string_buffer_t *sb, int errnum, const char *dir, int try_tmpdir) |
static int direxists | ( | const char * | pathname | ) | [static] |
Definition at line 41 of file path_search.c.
int explain_path_search | ( | char * | tmpl, |
size_t | tmpl_len, | ||
const char * | dir, | ||
const char * | pfx, | ||
int | try_tmpdir | ||
) |
The explain_path_search function may be used to determine where to place temporary files.
The following are searched for, in order 1. Uses the first of $TMPDIR (if try_tmpdir) 2. the dir argument 3. P_tmpdir 4. /tmp
Copies into tmpl a template suitable for use with mkstemp(), et al.
tmpl | Where to write the pathname template. |
tmpl_len | The maximum available size of the pathname template. |
dir | The preferred temporary directory. |
pfx | file name prefix, must not contail any slash (/) characters |
try_tmpdir | use the $TMPDIR environment variable, if set and exists. |
EINVAL The supplied buffer for tmpl is too small. ENOENT None of the directories in the search path exist.
Definition at line 59 of file path_search.c.
int explain_path_search_explanation | ( | struct explain_string_buffer_t * | sb, |
int | errnum, | ||
const char * | dir, | ||
int | try_tmpdir | ||
) |
The explain_path_search_explanation function may be used to
sb | buffer to write into |
errnum | the error to be explained |
dir | directory to search, as passwd to path_search |
try_tmpdir | use the $TMPDIR environment variable, if set and exists. |
Definition at line 179 of file path_search.c.
static void paths_push | ( | const char ** | paths, |
size_t * | paths_count, | ||
const char * | path | ||
) | [static] |
Definition at line 157 of file path_search.c.