cc [flag . . . ] file . . . -lgen [library] . . .
#include <stdio.h> #include <sys/mnttab.h>
int getmntent(FILE fp, struct mnttab mp);
int getmntany(FILE fp, struct mnttab mp, struct mnttab mpref);
getmntent and getmntany each fill in the structure pointed to by mp with the broken-out fields of a line in the /etc/mnttab file. Each line in the file contains a mnttab structure, declared in the sys/mnttab.h header file. It contains the following members:
char mnt_special; char mnt_mountp; char mnt_fstype; char mnt_mntopts; char mnt_time;
If the fields have meaning, the meanings are described in mnttab(F). Fields with no valid information are set to point at the null string.
getmntent returns a pointer to the next mnttab structure in the file; so successive calls can be used to search the entire file. getmntany searches the file referenced by fp until a match is found between a line in the file and mpref. mpref matches the line if all non-null entries in mpref match the corresponding fields in the file. Note that these routines do not open, close, or rewind the file.