GNU file utilities FILEUTILS-3_4_7
authorJim Meyering <jim@meyering.net>
Tue, 13 Apr 1993 20:29:32 +0000 (20:29 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 13 Apr 1993 20:29:32 +0000 (20:29 +0000)
lib/Makefile.in
lib/fnmatch.h
lib/fsusage.c
lib/mountlist.c

index fb21e13..affeea2 100644 (file)
@@ -78,12 +78,13 @@ libfu.a: $(OBJECTS)
 # is the only way to reliably do a parallel make.
 getdate.c: getdate.y
        @echo expect 9 shift/reduce conflicts
-       -bison -o getdate.c $(srcdir)/getdate.y || yacc $(srcdir)/getdate.y
+       -bison -o getdate.c $(srcdir)/getdate.y || $(YACC) $(srcdir)/getdate.y
        test ! -f y.tab.c || mv y.tab.c getdate.c
 
 # Make the rename atomic, in case sed is interrupted and later rerun.
 posixtm.c: posixtm.y
-       -bison -o posixtm.tab.c $(srcdir)/posixtm.y || yacc $(srcdir)/posixtm.y
+       -bison -o posixtm.tab.c $(srcdir)/posixtm.y \
+           || $(YACC) $(srcdir)/posixtm.y
        test ! -f y.tab.c || mv y.tab.c posixtm.tab.c
        sed -e 's/yy/zz/g' posixtm.tab.c > tposixtm.c
        mv tposixtm.c posixtm.c
index 2289f63..5c94813 100644 (file)
@@ -29,8 +29,9 @@ extern "C" {
 #else /* Not C++ or ANSI C.  */
 #undef __P
 #define        __P(args)       ()
-#undef const
-#define        const
+/* We can get away without defining `const' here only because in this file
+   it is used only inside the prototype for `fnmatch', which is elided in
+   non-ANSI C where `const' is problematical.  */
 #endif /* C++ or ANSI C.  */
 
 /* Bits set in the FLAGS argument to `fnmatch'.  */
index b434913..2a1fe86 100644 (file)
 
 int statfs ();
 
+#if defined (STATFS_OSF1)      /* DEC Alpha running OSF/1 */
+#  include <sys/mount.h>
+#endif
+
 #if defined(STAT_STATFS2_BSIZE) && !defined(_IBMR2) /* 4.3BSD, SunOS 4, HP-UX, AIX PS/2.  */
 #include <sys/vfs.h>
 #endif
@@ -80,6 +84,14 @@ get_fs_usage (path, disk, fsp)
      char *path, *disk;
      struct fs_usage *fsp;
 {
+#if defined (STATFS_OSF1)
+  struct statfs fsd;
+
+  if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
+    return (-1);
+#define convert_blocks(b) adjust_blocks ((b),fsd.f_fsize, 512)
+#endif /* STATFS_OSF1 */
+
 #ifdef STAT_STATFS2_FS_DATA    /* Ultrix.  */
   struct fs_data fsd;
 
index 88fda7a..1dc78c5 100644 (file)
@@ -36,6 +36,11 @@ char *xrealloc ();
 char *xstrdup ();
 void error ();
 
+#if defined (MOUNTED_GETFSSTAT)        /* __alpha running OSF_1 */
+#  include <sys/mount.h>
+#  include <sys/fs_types.h>
+#endif /* MOUNTED_GETFSSTAT */
+
 #ifdef MOUNTED_GETMNTENT1      /* 4.3BSD, SunOS, HP-UX, Dynix, Irix.  */
 #include <mntent.h>
 #if !defined(MOUNTED)
@@ -268,6 +273,43 @@ read_filesystem_list (need_fs_type, all_fs)
   }
 #endif /* MOUNTED_GETMNT. */
 
+#if defined (MOUNTED_GETFSSTAT)        /* __alpha running OSF_1 */
+  {
+    int numsys, counter, bufsize;
+    struct statfs *stats;
+
+    numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
+    if (numsys < 0)
+      return (NULL);
+
+    bufsize = (1 + numsys) * sizeof (struct statfs);
+    stats = (struct statfs *)xmalloc (bufsize);
+    numsys = getfsstat (stats, bufsize, MNT_WAIT);
+
+    if (numsys < 0)
+      {
+       free (stats);
+       return (NULL);
+      }
+
+    for (counter = 0; counter < numsys; counter++)
+      {
+       me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
+       me->me_devname = xstrdup (stats[counter].f_mntfromname);
+       me->me_mountdir = xstrdup (stats[counter].f_mntonname);
+       me->me_type = mnt_names[stats[counter].f_type];
+       me->me_dev = -1;        /* Magic; means not known yet. */
+       me->me_next = NULL;
+
+       /* Add to the linked list. */
+       mtail->me_next = me;
+       mtail = me;
+      }
+
+    free (stats);
+  }
+#endif /* MOUNTED_GETFSSTAT */
+
 #if defined (MOUNTED_FREAD) || defined (MOUNTED_FREAD_FSTYP) /* SVR[23].  */
   {
     struct mnttab mnt;