limb 0.2.0

2024-01-09

readopt(3)
limb manual
readopt(3)

NAME

readopt - read option from configuration directory

SYNOPSIS

#include <limb/readopt.h>
ssize_t readopt(char *dst, size_t dlen, int fd, const char *name)

DESCRIPTION

The readopt() function will read the first line from file name and write it into the memory pointed by dst, up to dlen bytes.

If name specifies a relative path, it is relative to the directory associated with the file descriptor fd, which may be AT_FDCWD to use the current working directory.

RETURN VALUE

On success the function returns the number of bytes written into dst (which is not NUL-terminated). Otherwise, it returns -1 and sets errno to indicate the error.

ERRORS

This function may fail if :

ENOBUFS

Not enough space in dst to write the full first line of the file.

This function may also fail for the errors described for open_read_closeat(3).

limb 0.1.0
2023-07-24
readopt(3)