+ printf(" %s\n", sfsp->f_mntonname);
+}
+
+/*
+ * This code constitutes the old df code for extracting
+ * information from filesystem superblocks.
+ */
+#include <ufs/fs.h>
+#include <errno.h>
+#include <fstab.h>
+
+union {
+ struct fs iu_fs;
+ char dummy[SBSIZE];
+} sb;
+#define sblock sb.iu_fs
+
+int fi;
+int bread();
+
+void
+ufs_df(file, maxwidth)
+ char *file;
+ long maxwidth;
+{
+ extern int errno;
+ struct statfs statfsbuf;
+ register struct statfs *sfsp;
+ char *mntpt;
+ static int synced;
+
+ if (synced++ == 0)
+ sync();
+
+ if ((fi = open(file, O_RDONLY)) < 0) {
+ fprintf(stderr, "df: %s: %s\n", file, strerror(errno));
+ return;
+ }
+ if (bread((long)SBOFF, (char *)&sblock, SBSIZE) == 0) {
+ (void) close(fi);
+ return;
+ }
+ sfsp = &statfsbuf;
+ sfsp->f_type = MOUNT_UFS;
+ sfsp->f_flags = 0;
+ sfsp->f_fsize = sblock.fs_fsize;
+ sfsp->f_bsize = sblock.fs_bsize;
+ sfsp->f_blocks = sblock.fs_dsize;
+ sfsp->f_bfree = sblock.fs_cstotal.cs_nbfree * sblock.fs_frag +
+ sblock.fs_cstotal.cs_nffree;
+ sfsp->f_bavail = (sblock.fs_dsize * (100 - sblock.fs_minfree) / 100) -
+ (sblock.fs_dsize - sfsp->f_bfree);
+ if (sfsp->f_bavail < 0)
+ sfsp->f_bavail = 0;
+ sfsp->f_files = sblock.fs_ncg * sblock.fs_ipg;
+ sfsp->f_ffree = sblock.fs_cstotal.cs_nifree;
+ sfsp->f_fsid.val[0] = 0;
+ sfsp->f_fsid.val[1] = 0;
+ if ((mntpt = getmntpt(file)) == 0)
+ mntpt = "";
+ bcopy((caddr_t)mntpt, (caddr_t)&sfsp->f_mntonname[0], MNAMELEN);
+ bcopy((caddr_t)file, (caddr_t)&sfsp->f_mntfromname[0], MNAMELEN);
+ prtstat(sfsp, maxwidth);