Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pathfind(3G) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sh(1)

test(1)

access(2)

mknod(2)

stat(2)

getenv(3C)

pathfind(3G)                                                   pathfind(3G)

NAME
     pathfind - search for named file in named directories

SYNOPSIS
     cc [flag ...] file ... -lgen [library ...]

     #include <libgen.h>

     char *pathfind(const char *path, const char *name,
                     const char *mode);

DESCRIPTION
     pathfind() searches the directories named in path for the file name.
     The directories named in path are separated by semicolons. mode is a
     string of option with the following meanings:
     Letter   Meaning
     r        readable
     w        writable
     x        executable
     f        normal file
     b        block special
     c        character special
     d        directory
     p        FIFO (pipe)
     u        set user ID bit
     g        set group ID bit
     k        sticky bit
     s        size nonzero

     Options read, write, and execute are checked relative to the real user
     ID and group ID of the current process.

     If the file name, with all the characteristics specified by mode, is
     found in any of the directories specified by path, then pathfind()
     returns a pointer to a string containing the member of path, followed
     by a slash character /, followed by name.

     If name begins with a slash, it is treated as an absolute path name,
     and path is ignored.

     An empty path member is treated as the current directory. ./ is not
     prepended at the occurrence of the first match; rather, the unadorned
     name is returned.

EXAMPLES
     To find the ls command using the PATH environment variable:

          pathfind (getenv ("PATH"), "ls", "rx")

RESULT
     If no match is found, pathfind() returns a null pointer, ((char *)0).




Page 1                       Reliant UNIX 5.44                Printed 11/98

pathfind(3G)                                                   pathfind(3G)

NOTES
     The string pointed to by the returned pointer is stored in a static
     area that is reused on subsequent calls to pathfind().

SEE ALSO
     sh(1), test(1), access(2), mknod(2), stat(2), getenv(3C).
















































Page 2                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026