From 9b9de6ce15f26c7214423fdcaa8c9d8a9e598044 Mon Sep 17 00:00:00 2001 From: ewt Date: Mon, 2 Jun 1997 19:59:07 +0000 Subject: [PATCH] Provide an alternate getmntent() if necessary. CVS patchset: 1679 CVS date: 1997/06/02 19:59:07 --- config.h.in | 4 ++++ configure.in | 1 + misc/miscfn.h | 34 +++++++++++++++++++++------------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/config.h.in b/config.h.in index 14c82ea..d80551b 100644 --- a/config.h.in +++ b/config.h.in @@ -83,4 +83,8 @@ /* Define as one if you have */ #define HAVE_SYS_MNTTAB_H 0 +/* Define as one if you have getmntent(), you'll also need one of the above + two defined */ +#define HAVE_GETMNTENT 0 + #endif diff --git a/configure.in b/configure.in index 5daa3fc..ccf449c 100644 --- a/configure.in +++ b/configure.in @@ -277,6 +277,7 @@ fi dnl Checks for library functions. AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), MISCOBJS="$MISCOBJS inet_aton.o") AC_CHECK_FUNC(realpath, AC_DEFINE(HAVE_REALPATH), MISCOBJS="$MISCOBJS realpath.o") +AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), MISCOBJS="$MISCOBJS getmntent.o") AC_CHECK_FUNC(strerror, [], MISCOBJS="$MISCOBJS strerror.o") AC_CHECK_FUNC(strtol, [], MISCOBJS="$MISCOBJS strtol.o") AC_CHECK_FUNC(strtoul, [], MISCOBJS="$MISCOBJS strtoul.o") diff --git a/misc/miscfn.h b/misc/miscfn.h index 5e5e51b..adabc77 100644 --- a/misc/miscfn.h +++ b/misc/miscfn.h @@ -62,21 +62,29 @@ extern void *myrealloc(void *, size_t); #define lchown chown #endif -#if HAVE_MNTENT_H -#include -#define GETMNTENT_ONE 1 -#define GETMNTENT_TWO 0 -#define our_mntent struct mntent -#define our_mntdir mnt_dir +#if HAVE_MNTENT_H || !(HAVE_GETMNTENT) +# if HAVE_MNTENT_H +# include +# else + #include + struct mntent { + char * mnt_dir; + }; + struct mntent *getmntent(FILE *filep); +# endif +# define GETMNTENT_ONE 1 +# define GETMNTENT_TWO 0 +# define our_mntent struct mntent +# define our_mntdir mnt_dir #elif HAVE_SYS_MNTTAB_H -#include -#include -#define GETMNTENT_ONE 0 -#define GETMNTENT_TWO 1 -#define our_mntdir mnt_mountp -#define our_mntent struct mnttab +# include +# include +# define GETMNTENT_ONE 0 +# define GETMNTENT_TWO 1 +# define our_mntent struct mnttab +# define our_mntdir mnt_mountp #else -#error Neither mntent.h nor mnttab.h exists. I cannot build on this system. +# error Neither mntent.h nor mnttab.h exists. I cannot build on this system. #endif #ifndef MOUNTED -- 2.7.4