getmntent(3C) DG/UX R4.11MU05 getmntent(3C)
NAME
getmntent, setmntent, addmntent, endmntent, hasmntopt - get file
system descriptor file entry
SYNOPSIS
#include <stdio.h>
#include <mntent.h>
FILE *setmntent(char *filep, char *type)
struct mntent *getmntent(FILE *filep)
int addmntent(FILE *filep, struct mntent *mnt)
char *hasmntopt(struct mntent *mnt, char *opt)
int endmntent(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/mnttab.
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 *mntfsname; /* name of mounted file system */
char *mntdir; /* file system path prefix */
char *mnttype; /* eg. dg/ux, nfs, swap, cdrom */
char *mntopts; /* eg. rw, ro, hard, soft, bg, fg */
int mntfreq; /* dump frequency, in days */
int mntpassno; /* pass number on parallel fsck */
};
addmntent adds the mntent structure mnt to the end of the open file
filep. addmntent returns 0 on success. Note: filep has to be opened
for writing if this is to work. hasmntopt scans the mntopts 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/mnttab
DIAGNOSTICS
NULL pointer (0) returned on EOF or error.
SEE ALSO
fopen(3S), getfsent(3C), fstab(4), mnttab(4), admfilesystem(1M).
CAVEATS
The returned mntent structure points to static information that is
overwritten in each call.
The admfilesystem command uses single non-numeric characters to
designate dump frequency. getmntent translates these single
characters in the fifth field of an /etc/fstab entry into equivalent
integer values in mntfreq. The translations are:
´x' (no dump) = 0
´d' (daily) = 1
´w' (weekly) = 7
´m' (monthly) = 30
The addmntent function does not perform the reverse translation. If
the mntfreq field is 7, a 7 (not 'w') will be written to /etc/fstab.
Licensed material--property of copyright holder(s)