Index of Section 3 Manual Pages

Interix / SUAdirname.3Interix / SUA

dirname(3)                                                   dirname(3)

  basename()

  NAME

    basename(), dirname() - parse a path name

  SYNOPSIS

    #include 

    char *basename (char *path)
    char *dirname (char *path)

  DESCRIPTION

    The basename(3) function returns a pointer to the final component of the
    path name referenced by the path argument. Typically the final component
    of a path name is the file name in the path name, or the final directory
    in the path name if the final character in path is a slash (/). If path
    consists entirely of the slash (/) character, basename(3) returns a
    pointer to the string "/". If path is a null pointer or points to a null
    string, basename(3) returns a pointer to the string ".".

    The dirname(3) function returns a pointer to the path name of the parent
    directory of the path name referenced by the path argument. Typically, the
    path name of the parent directory is the string up to, but not including,
    the last slash (/) character if it is not the final character in path. If
    a slash character is the final character in path, it is not considered
    part of the path, and so the token following the preceding slash character
    is considered the final component (base name) of the path name, not the
    parent directory. For example, if path is "/usr/share/" then dirname(3)
    returns a pointer to "/usr". If path consists entirely of the slash (/
    ) character, dirname(3) returns a pointer to the string "/". If path is a
    null pointer or points to a null string, or if path does not contain a
    slash, then dirname(3) returns a pointer to the string ".".

  RETURN VALUES

    The basename(3) function returns a pointer to a string containing the base
    name of the specified path name.

    The dirname(3) function returns a pointer to a string containing the path
    name of the parent directory of the specified path name.

  ERRORS

    None.

  USAGE NOTES

    The dirname function is thread safe. The basename function is not thread
    safe.

    None of these functions are async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA