The Hackerlab at `regexps.com`

## A VU Handler for the URL File-Descriptor Scheme

up: libhackerlab next: A VU Handler for the URL Socket Scheme prev: A VU Name Handler for Standard Input and Output

These functions provide a VU namespace handler for file-names of the form:

                 fd:N

where `N` is a non-negative integer.

Opening such a file, with this namespace handler installed, returns the indicated file descriptor.

Function `url_fd_push_handler`

    void url_fd_push_handler (int is_optional);

Push a VU namespace handler named fd which recognizes file-names using the regexp:

                 ^fd:[0-9]\+

It handles file names like:

                 fd:N

where `N` is a non-negative integer.

Opening such a file, with this namespace handler installed, returns the indicated file descriptor.

If the flag `is_optional` is `0` , the namespace handler is simply installed. If it is not `0` , the handler is registered under the name `"fd"` , but not installed.

(See vu_enable_optional_name_handler.)

Function `url_fd_to_fd`

    int url_fd_to_fd (int * errn, char * path);

Return the file descriptor number named by a filename of the form:

         fd:N

where `N` is a non-negative integer.

If the filename can not be parsed, `-1` is returned and `*errn` is set.

libhackerlab: The Hackerlab C Library
The Hackerlab at `regexps.com`