Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>getmntent</b> http://www.ousob.com [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
getmntent
=========

Syntax
------

     #include <mntent.h>
     
     struct mntent *getmntent(FILE *filep);

Description
-----------

This function returns information about the various drives that are
available to your program.  Beginning with drive `A:', information is
retrieved for successive drives with successive calls to `getmntent'.
Note that drives `A:' and `B:' will only be returned if there is an
MS-DOS formatted disk in the drive; empty drives are skipped.  For
systems with a single floppy drive, it is returned as if it were
mounted on A:/ or B:/, depending on how it was last referenced (and if
there is a disk in the drive).

For each drive scanned, a pointer to a static structure of the following
type is returned:

     struct mntent
     {
         char * mnt_fsname;  /* The name of this file system */
         char * mnt_dir;     /* The root directory of this file system */
         char * mnt_type;       /* Filesystem type */
         char * mnt_opts;    /* Options, see below */
         int    mnt_freq;    /* -1 */
         int    mnt_passno;  /* -1 */
         long   mnt_time;    /* -1 */
     };

DJGPP implementation returns the following in the first 4 fields of
`struct mntent':

`mnt_fsname'
     For networked and CD-ROM drives, the name of root directory in the
     form "\\HOST\PATH" (this is called a UNC name).

     For drives compressed with DoubleSpace, the string
     "X:\DBLSPACE.NNN", where "X" is the drive letter of the host drive
     and "NNN" is the sequence number of the Compressed Volume File.

     For drives compressed with Stacker, the string "X:\STACVOL.NNN",
     where "X" and "NNN" are as for DoubleSpace drives.

     For drives compressed with Jam (a shareware disk compression
     software), the full name of the Jam archive file.

     For SUBSTed drives, the actual directory name that that was
     SUBSTed to emulate a drive.

     JOINed drives get their name as if they were NOT JOINed (i.e.,
     either the label name or the default "Drive X:").

     For drives with a volume label, the name of the label; otherwise
     the string "Drive X:", where "X" is the drive letter.

`mnt_dir'
     For most drives, the name of its root directory "X:/" (where "X" is
     the drive letter), except that JOINed drives get this as the name
     of the directory to which they were JOINed.

     For systems with a single floppy drive (which can be referenced as
     either "a:/" or "b:/"), the mount directory will be returned as
     one of these, depending on which drive letter was last used to
     reference that drive.

`mnt_type'
           "fd"     for floppy disks
           "hd"     for hard disks
           "dblsp"  for disks compressed with DoubleSpace
           "stac"   for disks compressed with Stacker
           "jam"    for disks compressed with Jam
           "cdrom"  for CD-ROM drives
           "ram"    for RAM disks
           "subst"  for SUBSTed directories
           "join"   for JOINed disks
           "net"    for networked drives

`mnt_opts'
     The string "ro,dev=XX" for CD-ROM drives, "rw,dev=XX" for all the
     others, where "XX" is the hexadecimal drive number of the REAL
     drive on which this filesystem resides.  That is, if you call
     `stat' on MNT_FSNAME, you will get the numeric equivalent of XX in
     `st_dev' field of `struct stat'.  E.g., for drive C: you will get
     "rw,dev=02".  Note that SUBSTed and JOINed drives get the drive
     numbers as if SUBST and JOIN were NOT in effect.

Return Value
------------

This function returns a pointer to an `struct' `mntent', or NULL if
there are no more drives to report on.

Example
-------

     struct mntent *m;
     FILE *f;
     f = setmntent("/etc/mnttab", "r");
     while ((m = getmntent(f)))
       printf("Drive %s, name %s\n", m->mnt_dir, m->mnt_fsname);
     endmntent(f);


Online resources provided by: http://www.ousob.com --- NG 2 HTML conversion by Dave Pearson