NAME
open_parsed_name - return given file descriptor, or opened file
SYNOPSIS
#include <limb/djbunix.h>
typedef int (*open_fn) (const char *file) int open_parsed_name(const char *name, open_fn open)
DESCRIPTION
The open_parsed_name
() function parses name
which is either a file name, or
a file descriptor.
In the later case, it must begins with a plus-sign (+
) before the number of
the file descriptor, which will be returned.
In the former case, the file name will simply be passed to open
which shall
open said file and return the resulting file descriptor, or -1 in case of error,
setting errno
to indicate the error..
To specify a file whose name begins with a plus sign, simply use two plus-signs as beginning of the file.
RETURN VALUE
Upon successful completion, this function return the specified file descriptor,
or the file descriptor of the opened file. Otherwise, it returns -1 and sets
errno
to indicate the error.
ERRORS
This function may fail for the errors described for u16_scan0(3) (when parsing
the file descriptor), or those for open
.