GETMNTENT(3-BSD) RISC/os Reference Manual GETMNTENT(3-BSD)
NAME
getmntent, setmntent, addmntent, endmntent, hasmntopt - get
file system descriptor file entry
SYNOPSIS
Headers
For -systype svr3:
#include <bsd/sys/types.h>
#include <stdio.h>
#include <mntent.h>
For -systype bsd43:
#include <stdio.h>
#include <mntent.h>
Declarations
FILE *setmntent(filep, type)
char *filep;
char *type;
struct mntent *getmntent(filep)
FILE *filep;
int addmntent(filep, mnt)
FILE *filep;
struct mntent *mnt;
char *hasmntopt(mnt, opt)
struct mntent *mnt;
char *opt;
int endmntent(filep)
FILE *filep;
DESCRIPTION
These routines replace the getfsent routines for accessing
the file system description file /etc/fstab. They are also
used to access the mounted file system description file
/etc/mtab.
setmntent opens a file system description file and returns a
file pointer which can then be used with getmntent,
addmntent, or endmntent. The type argument is the same as
in fopen(3S). getmntent reads the next line from 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, <mntent.h>. The fields have meanings
described in fstab(4).
struct mntent {
char *mnt_fsname; /* file system name */
char *mnt_dir; /* file system path prefix */
Printed 11/19/92 Page 1
GETMNTENT(3-BSD) RISC/os Reference Manual GETMNTENT(3-BSD)
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 */
};
addmntent adds the mntent structure mnt to the end of the
open file filep. Note that filep has to be opened for writ-
ing if this is to work. hasmntopt scans the mnt_opts field
of the mntent structure mnt for a substring that matches
opt. It returns the address of the substring if a match is
found, 0 otherwise. endmntent closes the file.
FILES
/etc/fstab
/etc/mtab
SEE ALSO
getfsent(3S), fstab(4).
DIAGNOSTICS
Null pointer (0) returned on EOF or error.
ERRORS
The returned mntent structure points to static information
that is overwritten in each call.
ORIGIN
Sun Microsystems Inc.
NOTE
When these routines are used in a program which is compiled
in -systype svr3, they are not resolved by libc.a. See
intro(3) for more information.
Page 2 Printed 11/19/92