.\" @(#)getmntent.3 1.1 85/12/28 SMI; from UCB 4.2 .TH GETMNTENT 3 "12 March 1985" .SH NAME setmntent, getmntent, addmntent, endmntent, hasmntopt \- get file system descriptor file entry .SH SYNOPSIS .nf .ft B #include <stdio.h> #include <mntent.h> .sp.5 FILE *setmntent(filep, type) char *filep; char *type; .sp.5 struct mntent *getmntent(filep) FILE *filep; .sp.5 int addmntent(filep, mnt) FILE *filep; struct mntent *mnt; .sp.5 char *hasmntopt(mnt, opt) struct mntent *mnt; char *opt; .sp.5 int endmntent(filep) FILE *filep; .fi .IX "setmntent function" "" "\fLsetmntent\fP \(em get filesystem descriptor file entry" .IX "getmntent function" "" "\fLgetmntent\fP \(em get filesystem descriptor file entry" .IX "addmntent function" "" "\fLaddmntent\fP \(em get filesystem descriptor file entry" .IX "endmntent function" "" "\fLendmntent\fP \(em get filesystem descriptor file entry" .IX "hasmntopt function" "" "\fLhasmntopt\fP \(em get filesystem descriptor file entry" .IX "get filesystem descriptor file entry" "setmntent" "" "\fLsetmntent\fP" .IX "get filesystem descriptor file entry" "getmntent" "" "\fLgetmntent\fP" .IX "get filesystem descriptor file entry" "addmntent" "" "\fLaddmntent\fP" .IX "get filesystem descriptor file entry" "endmntent" "" "\fLendmntent\fP" .IX "get filesystem descriptor file entry" "hasmntopt" "" "\fLhasmntopt\fP" .IX "filesystem descriptor" "get file entry" .SH DESCRIPTION These routines replace the .I getfsent routines for accessing the file system description file .IR /etc/fstab . They are also used to access the mounted file system description file .IR /etc/mtab . .PP .I Setmntent opens a file system description file and returns a file pointer which can then be used with .IR getmntent , .IR addmntent , or .IR endmntent . The .I type argument is the same as in .IR fopen (3). .I Getmntent reads the next line from .I filep and returns a pointer to an object with the following structure containing the broken-out fields of a line in the filesystem description file, .IR <mntent.h> . The fields have meanings described in .IR fstab (5). .RS .PP .ta \w'#define'u +\w'char\0\0'u +\w'*mnt_fsname;\0\0'u .nf 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 */ }; .fi .RE .PP .I Addmntent adds the .I mntent structure .I mnt to the end of the open file .IR filep . Note that .I filep has to be opened for writing if this is to work. .I Hasmntopt scans the .I mnt_opts field of the .I mntent structure .I mnt for a substring that matches .IR opt . It returns the address of the substring if a match is found, 0 otherwise. .I Endmntent closes the file. .SH FILES /etc/fstab .br /etc/mtab .SH "SEE ALSO" fstab(5), getfsent(3) .SH DIAGNOSTICS Null pointer (0) returned on EOF or error. .SH BUGS The returned .I mntent structure points to static information that is overwritten in each call.