summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-04-13 20:29:32 +0000
committerJim Meyering <jim@meyering.net>1993-04-13 20:29:32 +0000
commit19c6a346c7d75954dd1314c064d9f76fe74324ed (patch)
tree1f73fc9b8ac708181234973bba45bdc18cd5b0dd
parent00c3a8127a329b1e56c702e147d9a1d6c3351f0e (diff)
downloadgnulib-19c6a346c7d75954dd1314c064d9f76fe74324ed.tar.gz
GNU file utilitiesFILEUTILS-3_4_7
-rw-r--r--lib/Makefile.in5
-rw-r--r--lib/fnmatch.h5
-rw-r--r--lib/fsusage.c12
-rw-r--r--lib/mountlist.c42
4 files changed, 60 insertions, 4 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in
index fb21e13dc4..affeea23da 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -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
diff --git a/lib/fnmatch.h b/lib/fnmatch.h
index 2289f6345d..5c94813f4b 100644
--- a/lib/fnmatch.h
+++ b/lib/fnmatch.h
@@ -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'. */
diff --git a/lib/fsusage.c b/lib/fsusage.c
index b434913439..2a1fe86c75 100644
--- 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 @@ 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;
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 88fda7a615..1dc78c5ced 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -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;