- cu_mount_t *last = NULL;
-
- /* see lib/mountlist.c of coreutils for all (ugly) details! */
-
-/*
- there are two implementations of getmntent():
- * one argument getmntent:
- FILE *setmntent(const char *filename, const char *type);
- struct mntent *getmntent(FILE *fp);
- int endmntent(FILE *fp);
- * two argument getmntent:
- FILE *fopen(const char *path, const char *mode);
- int getmntent(FILE *fp, struct mnttab *mnt);
- int fclose(FILE *fp);
- and a third (linux/gnu style) version called getmntent_r, which is not used
- here (enough trouble with the two versions above).
-*/
-#if HAVE_GETMNTENT
-# if HAVE_GETMNTENT1
-# define setmntent setmntent
-# define endmntent endmntent
-# else
-# if HAVE_GETMNTENT2
-# define setmntent fopen
-# define endmntent fclose
-# else
-# error HAVE_GETMNTENT defined, but neither HAVE_GETMNTENT1 nor HAVE_GETMNTENT2
-# endif /* HAVE_GETMNTENT2 */
-# endif /* HAVE_GETMNTENT1 */
-#endif /* HAVE_GETMNTENT */
-
- /* the indentation is wrong. is there a better way to do this? */
-
-#if HAVE_GETMNTENT && defined(_PATH_MOUNTED)
- {
- FILE *mntf = NULL;
- if((mntf = setmntent(_PATH_MOUNTED, "r")) == NULL) {
- DBG("opening %s failed: %s", _PATH_MOUNTED, strerror(errno));
-#endif
-#if HAVE_GETMNTENT && defined(MNT_MNTTAB)
- {
- FILE *mntf = NULL;
- if((mntf = setmntent(MNT_MNTTAB, "r")) == NULL) {
- DBG("opening %s failed: %s", MNT_MNTTAB, strerror(errno));
-#endif
-#if HAVE_GETMNTENT && defined(MNTTABNAME)
- {
- FILE *mntf = NULL;
- if((mntf = setmntent(MNTTABNAME, "r")) == NULL) {
- DBG("opening %s failed: %s", MNTTABNAME, strerror(errno));
-#endif
-#if HAVE_LISTMNTENT
- {
- struct tabmntent *mntlist;
- if(listmntent(&mntlist, KMTAB, NULL, NULL) < 0) {
- DBG("calling listmntent() failed: %s", strerror(errno));
-#endif
-#if HAVE_GETVFSENT && defined(VFSTAB)
- /* this is as bad as the next one, read next comment */
- {
- FILE *mntf = NULL;
- if((mntf = fopen(VFSTAB, "r")) == NULL) {
- DBG("opening %s failed: %s", VFSTAB, strerror(errno));
-#endif
-#if HAVE_GETMNTENT && defined(_PATH_MNTTAB)
- /* _PATH_MNTTAB is usually /etc/fstab and so this should be really
- the very last thing to try, because it does not provide a list
- of currently mounted filesystems... */
- {
- FILE *mntf = NULL;
- if((mntf = setmntent(_PATH_MNTTAB, "r")) == NULL) {
- DBG("opening %s failed: %s", _PATH_MNTTAB, strerror(errno));
-#endif