Reverted to an older gpl2 version of mountlist.c, needed for integration in debian and ubuntu.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@681 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-03-17 12:40:25 +00:00
parent c6f4130efd
commit f009016624

View File

@ -3,10 +3,10 @@
Copyright (C) 1991, 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, Copyright (C) 1991, 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007 Free Software Foundation, Inc. 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or the Free Software Foundation; either version 2, or (at your option)
(at your option) any later version. any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -14,7 +14,8 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if(!defined(__WIN32__))&&(!defined(__amigaos4__))&&(!defined(__AROS__))&&(!defined(__MORPHOS__)) #if(!defined(__WIN32__))&&(!defined(__amigaos4__))&&(!defined(__AROS__))&&(!defined(__MORPHOS__))
@ -159,7 +160,6 @@
#undef closedir #undef closedir
#ifndef ME_DUMMY #ifndef ME_DUMMY
#ifdef __macosx__
# define ME_DUMMY(Fs_name, Fs_type) \ # define ME_DUMMY(Fs_name, Fs_type) \
(strcmp (Fs_type, "autofs") == 0 \ (strcmp (Fs_type, "autofs") == 0 \
|| strcmp (Fs_type, "none") == 0 \ || strcmp (Fs_type, "none") == 0 \
@ -178,22 +178,7 @@
|| strcmp (Fs_type, "fdesc") == 0 \ || strcmp (Fs_type, "fdesc") == 0 \
|| strcmp (Fs_type, "nfs") == 0 \ || strcmp (Fs_type, "nfs") == 0 \
|| strcmp (Fs_type, "volfs") == 0) || strcmp (Fs_type, "volfs") == 0)
#else
# define ME_DUMMY(Fs_name, Fs_type) \
(strcmp (Fs_type, "autofs") == 0 \
|| strcmp (Fs_type, "none") == 0 \
|| strcmp (Fs_type, "proc") == 0 \
|| strcmp (Fs_type, "subfs") == 0 \
|| strcmp (Fs_type, "sysfs") == 0 \
|| strcmp (Fs_type, "usbfs") == 0 \
|| strcmp (Fs_type, "devpts") == 0 \
|| strcmp (Fs_type, "tmpfs") == 0 \
/* for NetBSD 3.0 */ \
|| strcmp (Fs_type, "kernfs") == 0 \
/* for Irix 6.5 */ \
|| strcmp (Fs_type, "ignore") == 0)
#endif #endif
#endif // ME_DUMMY
#ifndef ME_REMOTE #ifndef ME_REMOTE
/* A file system is `remote' if its Fs_name contains a `:' /* A file system is `remote' if its Fs_name contains a `:'
@ -206,7 +191,7 @@
|| strcmp (Fs_type, "cifs") == 0))) || strcmp (Fs_type, "cifs") == 0)))
#endif #endif
#ifdef MOUNTED_GETMNTINFO #if MOUNTED_GETMNTINFO
# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME # if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
static char * static char *
@ -410,7 +395,6 @@ read_file_system_list (bool need_fs_type)
} }
#endif #endif
#ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ #ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
{ {
struct mntent *mnt; struct mntent *mnt;
@ -442,35 +426,7 @@ read_file_system_list (bool need_fs_type)
} }
#endif /* MOUNTED_GETMNTENT1. */ #endif /* MOUNTED_GETMNTENT1. */
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */ #ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
#if defined(__macosx__) || defined(__FreeBSD__)
{
struct statfs *fsp;
int entries;
int i;
entries = getmntinfo (&fsp, MNT_NOWAIT);
if (entries < 0)
return NULL;
for (i = 0; i < entries; i++)
{
me = malloc (sizeof *me);
me->me_devname = strdup (fsp->f_mntfromname);
me->me_mountdir = strdup (fsp->f_mntonname);
me->me_type = fsp->f_fstypename;
me->me_type_malloced = 0;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
fsp++;
}
}
#else
{ {
struct statfs *fsp; struct statfs *fsp;
int entries; int entries;
@ -480,12 +436,10 @@ read_file_system_list (bool need_fs_type)
return NULL; return NULL;
for (; entries-- > 0; fsp++) for (; entries-- > 0; fsp++)
{ {
char *fs_type = fsp_to_string (fsp); me = malloc (sizeof *me);
me->me_devname = strdup (fsp->f_mntfromname);
me = xmalloc (sizeof *me); me->me_mountdir = strdup (fsp->f_mntonname);
me->me_devname = xstrdup (fsp->f_mntfromname); me->me_type = fsp->fs_typename;
me->me_mountdir = xstrdup (fsp->f_mntonname);
me->me_type = fs_type;
me->me_type_malloced = 0; me->me_type_malloced = 0;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
@ -496,10 +450,8 @@ read_file_system_list (bool need_fs_type)
mtail = &me->me_next; mtail = &me->me_next;
} }
} }
#endif
#endif /* MOUNTED_GETMNTINFO */ #endif /* MOUNTED_GETMNTINFO */
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */ #ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
{ {
struct statvfs *fsp; struct statvfs *fsp;
@ -515,7 +467,6 @@ read_file_system_list (bool need_fs_type)
me->me_mountdir = xstrdup (fsp->f_mntonname); me->me_mountdir = xstrdup (fsp->f_mntonname);
me->me_type = xstrdup (fsp->f_fstypename); me->me_type = xstrdup (fsp->f_fstypename);
me->me_type_malloced = 1; me->me_type_malloced = 1;
prtinf("device: %s\n", me->me_devname);
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
@ -949,5 +900,3 @@ read_file_system_list (bool need_fs_type)
return NULL; return NULL;
} }
} }
#endif