First pass at SCO getmntent()

CVS patchset: 1702
CVS date: 1997/06/19 13:30:47
This commit is contained in:
ewt 1997-06-19 13:30:47 +00:00
parent a25a642bbb
commit bfad9c3271
4 changed files with 18 additions and 2 deletions

View File

@ -90,4 +90,7 @@
/* Define as one if you have mntctl() (only aix?) */
#define HAVE_MNTCTL 0
/* Define as one if you have "struct mnttab" (only sco?) */
#define HAVE_STRUCT_MNTTAB 0
#endif

View File

@ -356,6 +356,7 @@ elif echo "$build_os" | grep sco > /dev/null; then
echo "hacking things up for sco"
RPM=rpm.shared
AC_DEFINE(NEED_STRINGS_H)
AC_DEFINE(HAVE_STRUCT_MNTTAB)
elif echo "$build_os" | grep sunos > /dev/null; then
echo "hacking things up for sunos"
CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"

View File

@ -11,6 +11,16 @@
#define COMMENTCHAR '#'
#endif
#if HAVE_STRUCT_MNTTAB {
our_mntent * getmntent(FILE *filep) {
static struct mnttab entry;
static our_mntent item = { entry.mt_filsys };
if (!fread(&entry, sizeof(entry), 1, filep)) return NULL;
return &item;
}
#else {
our_mntent *getmntent(FILE *filep) {
static our_mntent item = { NULL };
char buf[1024], * start;
@ -56,3 +66,4 @@ our_mntent *getmntent(FILE *filep) {
return NULL;
}
}

View File

@ -62,8 +62,8 @@ extern void *myrealloc(void *, size_t);
#define lchown chown
#endif
#if HAVE_MNTENT_H || !(HAVE_GETMNTENT)
# if HAVE_MNTENT_H
#if HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
# if HAVE_MNTENT_H || HAVE_STRUCT_MNTTAB
# include <mntent.h>
# define our_mntent struct mntent
# define our_mntdir mnt_dir
@ -84,6 +84,7 @@ extern void *myrealloc(void *, size_t);
# define GETMNTENT_TWO 1
# define our_mntent struct mnttab
# define our_mntdir mnt_mountp
#define
#else if !HAVE_MNTCTL
# error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
#endif