First pass at SCO getmntent()
authorewt <devnull@localhost>
Thu, 19 Jun 1997 13:30:47 +0000 (13:30 +0000)
committerewt <devnull@localhost>
Thu, 19 Jun 1997 13:30:47 +0000 (13:30 +0000)
CVS patchset: 1702
CVS date: 1997/06/19 13:30:47

config.h.in
configure.in
misc/getmntent.c
misc/miscfn.h

index a45c709..2702668 100644 (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
index 585606b..6393251 100644 (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__"
index c1506c6..5bea0aa 100644 (file)
 #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;
 }
+}
index dc6cbcd..e655926 100644 (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