X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fmountlist.c;h=de3e078c164e9654b24d8548b5ad487f42f928da;hb=ef1a7364a77f86eb148a6f0bec2fedf26ba1c11d;hp=aeb716ef1db72253c0d5cf81df496531a85f199d;hpb=57d62c350b88559f856d57bf215e17f033b98e7d;p=gnulib.git diff --git a/lib/mountlist.c b/lib/mountlist.c index aeb716ef1..de3e078c1 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -1,5 +1,5 @@ /* mountlist.c -- return a list of mounted filesystems - Copyright (C) 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -99,6 +99,17 @@ void error (); # define MOUNTED_GETMNTTBL #endif +#ifdef HAVE_SYS_MNTENT_H +/* This is to get MNTOPT_IGNORE on e.g. SVR4. */ +# include +#endif + +#if defined (MNTOPT_IGNORE) && defined (HAVE_HASMNTOPT) +# define MNT_IGNORE(M) hasmntopt ((M), MNTOPT_IGNORE) +#else +# define MNT_IGNORE(M) 0 +#endif + #ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ /* Return the value of the hexadecimal number represented by CP. No prefix (like '0x') or suffix (like 'h') is expected to be @@ -127,7 +138,7 @@ xatoi (cp) } #endif /* MOUNTED_GETMNTENT1. */ -#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__) +#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__) && !defined (__OpenBSD__) static char * fstype_to_string (t) short t; @@ -345,7 +356,7 @@ read_filesystem_list (need_fs_type, all_fs) me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry)); me->me_devname = xstrdup (fsp->f_mntfromname); me->me_mountdir = xstrdup (fsp->f_mntonname); -# ifdef __NetBSD__ +# if defined (__NetBSD__) || defined (__OpenBSD__) me->me_type = xstrdup (fsp->f_fstypename); # else me->me_type = fstype_to_string (fsp->f_type); @@ -502,6 +513,10 @@ read_filesystem_list (need_fs_type, all_fs) while ((ret = getmntent (fp, &mnt)) == 0) { + /* Don't show automounted filesystems twice on e.g., Solaris. */ + if (!all_fs && MNT_IGNORE (&mnt)) + continue; + me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry)); me->me_devname = xstrdup (mnt.mnt_special); me->me_mountdir = xstrdup (mnt.mnt_mountp);