Chapter Contents |
Previous |
Next |
pathconf |
Portability: | POSIX.1 conforming |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
EXAMPLE | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <unistd.h> long pathconf(const char *pathname, int configvar);
DESCRIPTION |
pathconf
determines
the value of a configuration variable that is associated with a file or directory
name.
pathname
is the file
or directory.
configvar
is the configuration variable.
configvar
is specified as one of the following symbols defined in
<unisted.h>
:
_PC_LINK_MAX
pathconf
returns the maximum number of links possible for the directory.
_PC_MAX_CANON
pathname
refers to a character special file for a terminal.
_PC_MAX_INPUT
pathname
refers to a character special file for a terminal.
_PC_NAME_MAX
_PC_PATH_MAX
_PC_PIPE_BUF
pathconf
returns the value for the file itself. For directories,
pathconf
returns the value for
FIFO special files that exist or can be created under the specified directory.
For other kinds of files, an
errno
of
EINVAL
is stored.
_PC_CHOWN_RESTRICTED
chown
is restricted. For directories,
pathconf
returns the value for
files, but not for subdirectories.
_PC_NO_TRUNC
_PC_VDISABLE
pathname
must refer to a character
special file for the terminal.
RETURN VALUE |
If successful,
pathconf
returns the value defined above for the particular value of
configvar
. If not successful,
pathconf
returns
-1
.
EXAMPLE |
The following code fragment illustrates
the use of
pathconf
to
determine the maximum number of characters in a filename:
#include <unistd.h> #include <errno.h> #include <stdio.h> . . . long result; errno = 0; if ((result = pathconf("/",_PC_NAME_MAX)) == -1) if (errno == 0) puts("NAME_MAX has no limit."); else perror("pathconf() error"); else print("NAME_MAX is %ld\n", result); . . .
RELATED FUNCTIONS |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.