-->
Page 922
RETURN VALUE
The fgetgrent()function returns the group information structure, or NULL if there are no more entries or an error occurs.
ERRORS
ENOMEM Insufficient memory to allocate group information structure.
CONFORMS TO
SVID 3
SEE ALSO
getgrnam(3), getgrgid(3), getgrent(3), setgrent(3), endgrent(3)
GNU, 4 April 1993
fgetpwentGets password file entry
SYNOPSIS
#include <pwd.h> #include <stdio.h> #include <sys/types.h> struct passwd *fgetpwent(FILE *stream);
DESCRIPTION
The fgetpwent() function returns a pointer to a structure containing the broken-out fields of a line in the file stream. The first time it is called it returns the first entry; thereafter, it returns successive entries. The file stream must have the same format as /etc/passwd.
The passwd structure is defined in <pwd.h> as follows:
struct passwd { char *pw_name; /* username */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user id */ gid_t pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ };
RETURN VALUE
The fgetpwent() function returns the passwd structure, or NULL if there are no more entries or an error occurs.
ERRORS
ENOMEM Insufficient memory to allocate passwd structure.
FILES
/etc/passwd password database file
CONFORMS TO
SVID 3
SEE ALSO
getpwnam(3), getpwuid(3), getpwent(3), setpwent(3), endpwent(3), getpw(3), putpwent( 3), passwd(5)
GNU, 17 May 1996
floorLargest integral value not greater than x
SYNOPSIS
#include <math.h> double floor(double x);
DESCRIPTION
The floor() function rounds x downward to the nearest integer, returning that value as a double.
CONFORMS TO
SVID 3, POSIX, BSD 4.3, ISO 9899
SEE ALSO
abs(3), fabs(3), ceil(3), rint(3)
6 June 1993
fmodFloating-point remainder function
SYNOPSIS
#include <math.h> double fmod(double x, double y);
DESCRIPTION
The modf() function computes the remainder of dividing x by y. The return value is x_n*y, where n is the quotient of x/y, rounded toward 0 to an integer.
RETURN VALUE
The fmod() function returns the remainder unless y is 0, in which case the function fails and errno is set.
ERRORS
EDOM The denominator y is 0.
CONFORMS TO
SVID 3, POSIX, BSD 4.3, ISO 9899
SEE ALSO
drem(3)
6 June 1993
Page 924
fnmatchMatches filename or pathname
SYNOPSIS
#include <fnmatch.h> int fnmatch(const char *pattern, const char *strings,int flags);
DESCRIPTION
fnmatch() checks the strings argument and checks whether it matches the pattern argument, which is a shell wildcard pattern.
The flags argument modifies the behavior; it is the bitwise OR of zero or more of the following flags:
FNM_NOESCAPE | If this flag is set, treat backslash as an ordinary character instead of as an escape character. |
FNM_PATHNAME | If this flag is set, match a slash in string only with a slash in pattern and not, for example, with a [] - sequence containing a slash. |
FNM_PERIOD | If this flag is set, a leading period in string has to be matched exactly by a period in pattern. A period is considered to be leading if it is the first character in string, or if both FNM_PATHNAME is set and the period immediately follows a slash. |
RETURN VALUE
Zero if string matches pattern, FNM_NOMATCH if there is no match, or another value if there is an error.
CONFORMS TO
Proposed POSIX.2
BUGS
POSIX.2 is not yet an approved standard; the information in this man page is subject to change.
SEE ALSO
sh(1), glob(3), glob(7)
GNU, 19 April 1993
fopen, fdopen, freopenStream open functions
SYNOPSIS
#include <stdio.h> FILE *fopen( char *path, char *mode); FILE *fdopen( int fildes, char *mode); FILE *freopen( char *path, char *mode,FILE*stream);
DESCRIPTION
The fopen function opens the file whose name is the string pointed to by path and associates a stream with it.
The argument mode points to a string beginning with one of the following sequences (additional characters may follow these sequences):
r | Open text file for reading. The stream is positioned at the beginning of the file. |
r+ | Open for reading and writing. The stream is positioned at the beginning of the file. |
Page 925
w | Truncate file to zero length or create a text file for writing. The stream is positioned at the beginning of the file. |
w+ | Open for reading and writing. The file is created if it does not exist; otherwise it is truncated. The stream is positioned at the beginning of the file. |
a | Open for writing. The file is created if it does not exist. The stream is positioned at the end of the file. |
a+ | Open for reading and writing. The file is created if it does not exist. The stream is positioned at the end of the file. |
The mode string can also include the letter b either as a third character or as a character between the characters in any of the two-character strings described previously. This is strictly for compatibility with ANSI C3.159-1989 (ANSI C) and has no effect; the b is ignored.
Any created files will have mode S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH (0666), as modified by the process's umask value. (See umask(2).)
Reads and writes may be intermixed on read/write streams in any order. Note that ANSI C requires that a file positioning function intervene between output and input, unless an input operation encounters end-of-file. (If this condition is not met, then a read is allowed to return the result of writes other than the most recent.) Therefore it is good practice (and indeed sometimes necessary under Linux) to put an fseek or fgetpos operation between write and read operations on such a stream. This operation may be an apparent no-op (as in fseek(..., 0L, SEEK_CUR)) called for its synchronizing side effect.
The fdopen function associates a stream with the existing file descriptor, fildes. The mode of the stream must be compatible with the mode of the file descriptor. The file descriptor is not duplicated.
The freopen function opens the file whose name is the string pointed to by path and associates the stream pointed to by stream with it. The original stream (if it exists) is closed. The mode argument is used just as in the fopen function. The primary use of the freopen function is to change the file associated with a standard text stream (stderr, stdin, or stdout).
RETURN VALUES
On successful completion, fopen, fdopen, and freopen return a FILE pointer. Otherwise, NULL is returned, and the global variable errno is set to indicate the error.
ERRORS
EINVAL | The mode provided to fopen, fdopen, or freopen was invalid. |
The fopen, fdopen, and freopen functions may also fail and set errno for any of the errors specified for the routine malloc(3).
The fopen function may also fail and set errno for any of the errors specified for the routine open(2).
The fdopen function may also fail and set errno for any of the errors specified for the routine fcntl(2).
The freopen function may also fail and set errno for any of the errors specified for the routines open(2), fclose(3) and fflush(3).
SEE ALSO
open(2), fclose(3)
STANDARDS
The fopen and freopen functions conform to ANSI C3.159-1989 (ANSI C). The fdopen function conforms to IEEE Std1003.1-1988 (POSIX.1).
BSD Man Page, 13 December 1995
fpathconf, pathconfGet configuration values for files
Page 926
SYNOPSIS
#include <unistd.h> long fpathconf(int filedes,intname); long pathconf(char *path, int name);
DESCRIPTION
fpathconf() gets a value for the configuration option name for the open file descriptor filedes.
pathconf() gets a value for configuration option name for the filename path.
The corresponding macros defined in <unistd.h> are the minimum values; if an application wants to take advantage of values that may change, a call to fpathconf() or pathconf() can be made, which may yield more liberal results.
Setting name equal to one of the following constants returns the following configuration options:
_PC_LINK_MAX | Returns the maximum number of links to the file. If filedes or path refers to a directory, the value applies to the whole directory. The corresponding macro is _POSIX_LINK_MAX. |
_PC_MAX_CANON | Returns the maximum length of a formatted input line, where filedes or path must refer to a terminal. The corresponding macro is _POSIX_MAX_CANON. |
_PC_MAX_INPUT | Returns the maximum length of an input line, where filedes or path must refer to a terminal. The corresponding macro is _POSIX_MAX_INPUT. |
_PC_NAME_MAX | Returns the maximum length of a filename in the directory path or filedes the process is allowed to create. The corresponding macro is _POSIX_MAX_. |
_PC PATH_MAX | Returns the maximum length of a relative pathname when path or filedes is the current working directory. The corresponding macro is _POSIX_PATH_MAX. |
_PC_PIPE_BUF | Returns the size of the pipe buffer, where filedes must refer to a pipe or FIFO, and path must refer to a FIFO. The corresponding macro is _POSIX_PIPE_BUF. |
_PC_CHOWN_RESTRICTED | Returns nonzero if the chown(2) call may not be used on this file. If filedes or path refers to a directory, this applies to all files in that directory. The corresponding macro is _POSIX_CHOWN_RESTRICTED. |
_PC_NO_TRUNC | Returns nonzero if accessing filenames longer than _POSIX_NAME_MAX generates an error. The corresponding macro is _POSIX_NO_TRUNC. |
_PC_VDISABLE | Returns nonzero if special character processing can be disabled, where filedes or path must refer to a terminal. |
RETURN VALUE
The limit is returned, if one exists. If the system does not have a limit for the requested resource, _1 is returned, and errno is unchanged. If there is an error, _1 is returned, and errno is set to reflect the nature of the error.
CONFORMS TO
POSIX.1. Files with name lengths longer than the value returned for name equal to _PC_NAME_MAX may exist in the given directory.
Some returned values may be huge; they are not suitable for allocating memory.
SEE ALSO
getconf(1), statfs(2), open(2), sysconf(3)
GNU, 4 April 1993
fread, fwriteBinary stream input/output