GETFSENT

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
BSD 4  

NAME

getfsent getfsspec getfsfile setfsent endfsent - get file system descriptor file entry  

SYNOPSIS

Fd #include <fstab.h> Ft fstab * Fn getfsent void Ft struct fstab * Fn getfsspec const char *spec Ft struct fstab * Fn getfsfile const char *file Ft int Fn setfsent void Ft void Fn endfsent void  

DESCRIPTION

The Fn getfsent , Fn getfsspec , and Fn getfsfile functions each return a pointer to an object with the following structure containing the broken-out fields of a line in the file system description file, Aq Pa fstab.h .
struct fstab {
        char    *fs_spec;       /* block special device name */
        char    *fs_file;       /* file system path prefix */
        char    *fs_vfstype;    /* type of file system */
        char    *fs_mntops;     /* comma separated mount options */
        char    *fs_type;       /* rw, ro, sw, or xx */
        int     fs_freq;        /* dump frequency, in days */
        int     fs_passno;      /* pass number on parallel dump */
};

The fields have meanings described in fstab(5).

The Fn setfsent function opens the file (closing any previously opened file) or rewinds it if it is already open.

The Fn endfsent function closes the file.

The Fn getfsspec and Fn getfsfile functions search the entire file (opening it if necessary) for a matching special file name or file system file name.

For programs wishing to read the entire database, Fn getfsent reads the next entry (opening the file if necessary).

All entries in the file with a type field equivalent to FSTAB_XX are ignored.  

RETURN VALUES

The Fn getfsent , Fn getfsspec , and Fn getfsfile functions return a null pointer (0) on EOF or error. The Fn setfsent function returns 0 on failure, 1 on success. The Fn endfsent function returns nothing.  

FILES

/etc/fstab

 

SEE ALSO

fstab(5)  

HISTORY

The Fn getfsent function appeared in BSD 4.0 the Fn endfsent , Fn getfsfile , Fn getfsspec , and Fn setfsent functions appeared in BSD 4.3  

BUGS

These functions use static data storage; if the data is needed for future use, it should be copied before any subsequent calls overwrite it.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
FILES
SEE ALSO
HISTORY
BUGS

This document was created by man2html, using the manual pages.
Time: 06:42:42 GMT, May 19, 2025