changeset 57:63b43eab1c61

GNU file utilities
author Jim Meyering <jim@meyering.net>
date Tue, 13 Apr 1993 20:29:32 +0000
parents 05adbdfa0f87
children 4dc25cfd0b27
files lib/Makefile.in lib/fnmatch.h lib/fsusage.c lib/mountlist.c
diffstat 4 files changed, 60 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -78,12 +78,13 @@
 # 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
--- a/lib/fnmatch.h
+++ b/lib/fnmatch.h
@@ -29,8 +29,9 @@
 #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'.  */
--- a/lib/fsusage.c
+++ b/lib/fsusage.c
@@ -20,6 +20,10 @@
 
 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 @@
      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;
 
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -36,6 +36,11 @@
 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 @@
   }
 #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;