GETMNTENT(3) UNIX Programmer's Manual GETMNTENT(3) NAME setmntent, getmntent, addmntent, endmntent, hasmntopt - get file system descriptor file entry SYNOPSIS #include <stdio.h> #include <mntent.h> 9 FILE *setmntent(filep, type) char *filep; char *type; 9 struct mntent *getmntent(filep) FILE *filep; 9 int addmntent(filep, mnt) FILE *filep; struct mntent *mnt; 9 char *hasmntopt(mnt, opt) struct mntent *mnt; char *opt; 9 int endmntent(filep) FILE *filep; DESCRIPTION These routines replace the _g_e_t_f_s_e_n_t routines for accessing the file system description file /_e_t_c/_f_s_t_a_b. They are also used to access the mounted file system description file /_e_t_c/_m_t_a_b. _S_e_t_m_n_t_e_n_t opens a file system description file and returns a file pointer which can then be used with _g_e_t_m_n_t_e_n_t, _a_d_d_m_n_t_e_n_t, or _e_n_d_m_n_t_e_n_t. The _t_y_p_e argument is the same as in _f_o_p_e_n(3). _G_e_t_m_n_t_e_n_t reads the next line from _f_i_l_e_p and returns a pointer to an object with the following structure containing the broken-out fields of a line in the filesystem description file, <_m_n_t_e_n_t._h>. The fields have meanings described in _f_s_t_a_b(5). struct mntent { char *mnt_fsname; /* file system name */ char *mnt_dir; /* file system path prefix */ char *mnt_type; /* 4.2, nfs, swap, or xx */ char *mnt_opts; /* ro, quota, etc. */ int mnt_freq; /* dump frequency, in days */ int mnt_passno; /* pass number on parallel fsck */ }; _A_d_d_m_n_t_e_n_t adds the _m_n_t_e_n_t structure _m_n_t to the end of the open file _f_i_l_e_p. Note that _f_i_l_e_p has to be opened for writ- ing if this is to work. _H_a_s_m_n_t_o_p_t scans the _m_n_t__o_p_t_s field of the _m_n_t_e_n_t structure _m_n_t for a substring that matches _o_p_t. It returns the address of the substring if a match is Printed 12/27/86 12 March 1985 1 9 GETMNTENT(3) UNIX Programmer's Manual GETMNTENT(3) found, 0 otherwise. _E_n_d_m_n_t_e_n_t closes the file. FILES /etc/fstab /etc/mtab SEE ALSO fstab(5), getfsent(3) DIAGNOSTICS Null pointer (0) returned on EOF or error. BUGS The returned _m_n_t_e_n_t structure points to static information that is overwritten in each call. Printed 12/27/86 12 March 1985 2