libexplain  1.4.D001
Functions
libexplain/path_search.h File Reference
#include <libexplain/ac/stddef.h>

Go to the source code of this file.

Functions

int explain_path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, int try_tmpdir)
int explain_path_search_explanation (struct explain_string_buffer_t *sb, int errnum, const char *dir, int try_tmpdir)

Function Documentation

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.

Parameters:
tmplWhere to write the pathname template.
tmpl_lenThe maximum available size of the pathname template.
dirThe preferred temporary directory.
pfxfile name prefix, must not contail any slash (/) characters
try_tmpdiruse the $TMPDIR environment variable, if set and exists.
Returns:
0 on success,or -1 on error (with errno set).

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

Parameters:
sbbuffer to write into
errnumthe error to be explained
dirdirectory to search, as passwd to path_search
try_tmpdiruse the $TMPDIR environment variable, if set and exists.
Returns:
0 if printed something, -1 if couldn't explain error

Definition at line 179 of file path_search.c.