static void printstat(struct statfs *sfsp, struct maxWidths *mwp)
{
	static u_long blocksize;
	static int headerlen, timesthrough = 0;
	static const char *header;
	
	int64_t used, availblocks; // inodes;
	
	if(++timesthrough == 1) {
		header = getbsize(&headerlen, &blocksize);
	}
	
	used = sfsp->f_blocks - sfsp->f_bfree;
	availblocks = sfsp->f_bavail + used;
	
	/* print Devices */	
	(void)mvwprintw(FSPAD, counter_FS, 2, "%-*s", mwp->MountFrom, sfsp->f_mntfromname);
	
	/* Mount Dir */
	
	(void)mvwprintw(FSPAD,counter_FS,16, "%s", sfsp->f_mntonname);
	
	/* Spaces */
	
	(void)mvwprintw(FSPAD, counter_FS, 40, " %*jd %*jd %*jd",
		    mwp->Total, fsbtoblk(sfsp->f_blocks,
		    sfsp->f_bsize, blocksize),
		    mwp->Used, fsbtoblk(used, sfsp->f_bsize, blocksize),
		    mwp->Available, fsbtoblk(sfsp->f_bavail,
		    sfsp->f_bsize, blocksize));  
	
	/* Move Cursor Down */
	wmove(FSPAD, counter_FS++, 2);
	
}
Beispiel #2
0
/*
 * Print out status about a filesystem.
 */
static void
prtstat(struct statfs *sfsp, int maxwidth, int headerlen, int blocksize)
{
	u_int64_t used, inodes;
	int64_t availblks;

	(void)printf("%-*.*s", maxwidth, maxwidth, sfsp->f_mntfromname);
	used = sfsp->f_blocks - sfsp->f_bfree;
	availblks = sfsp->f_bavail + used;
	if (hflag)
		prthuman(sfsp, used);
	else
		(void)printf(" %*llu %9llu %9lld", headerlen,
		    fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize),
		    fsbtoblk(used, sfsp->f_bsize, blocksize),
		    fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, blocksize));
	(void)printf(" %5.0f%%",
	    availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
	if (iflag) {
		inodes = sfsp->f_files;
		used = inodes - sfsp->f_ffree;
		(void)printf(" %7llu %7llu %5.0f%% ", used, sfsp->f_ffree,
		   inodes == 0 ? 100.0 : (double)used / (double)inodes * 100.0);
	} else
		(void)printf("  ");
	(void)printf("  %s\n", sfsp->f_mntonname);
}
Beispiel #3
0
/*
 * Print out status about a filesystem.
 */
void
prtstat(struct statfs *sfsp, struct statvfs *vsfsp, struct maxwidths *mwp)
{
    static long blocksize;
    static int headerlen, timesthrough;
    static const char *header;
    int64_t used, availblks, inodes;

    if (++timesthrough == 1) {
        mwp->mntfrom = imax(mwp->mntfrom, strlen("Filesystem"));
        if (hflag) {
            header = "  Size";
            mwp->total = mwp->used = mwp->avail = strlen(header);
        } else {
            header = getbsize(&headerlen, &blocksize);
            mwp->total = imax(mwp->total, headerlen);
        }
        mwp->used = imax(mwp->used, strlen("Used"));
        mwp->avail = imax(mwp->avail, strlen("Avail"));

        printf("%-*s %-*s %*s %*s Capacity", mwp->mntfrom,
               "Filesystem", mwp->total, header, mwp->used, "Used",
               mwp->avail, "Avail");
        if (iflag) {
            mwp->iused = imax(mwp->iused, strlen("  iused"));
            mwp->ifree = imax(mwp->ifree, strlen("ifree"));
            printf(" %*s %*s %%iused", mwp->iused - 2,
                   "iused", mwp->ifree, "ifree");
        }
        printf("  Mounted on\n");
    }
    printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname);
    used = vsfsp->f_blocks - vsfsp->f_bfree;
    availblks = vsfsp->f_bavail + used;
    if (hflag) {
        prthuman(vsfsp, used);
    } else {
        printf(" %*jd %*jd %*jd", mwp->total,
               fsbtoblk(vsfsp->f_blocks, vsfsp->f_bsize, blocksize),
               mwp->used, fsbtoblk(used, vsfsp->f_bsize, blocksize),
               mwp->avail, fsbtoblk(vsfsp->f_bavail, vsfsp->f_bsize,
                                    blocksize));
    }
    printf(" %5.0f%%",
           availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
    if (iflag) {
        inodes = vsfsp->f_files;
        used = inodes - vsfsp->f_ffree;
        printf(" %*jd %*jd %4.0f%% ", mwp->iused, (intmax_t)used,
               mwp->ifree, (intmax_t)vsfsp->f_ffree, inodes == 0 ? 100.0 :
               (double)used / (double)inodes * 100.0);
    } else
        printf("  ");
    printf("  %s\n", sfsp->f_mntonname);
}
Beispiel #4
0
/*
 * Update the maximum field-width information in `mwp' based on
 * the filesystem specified by `sfsp'.
 */
void
update_maxwidths(struct maxwidths *mwp, struct statfs *sfsp)
{
	static long blocksize;
	int dummy;

	if (blocksize == 0)
		getbsize(&dummy, &blocksize);

	mwp->mntfrom = imax(mwp->mntfrom, (int)strlen(sfsp->f_mntfromname));
	mwp->total = imax(mwp->total, longwidth(fsbtoblk(sfsp->f_blocks,
							 sfsp->f_bsize, blocksize, sfsp->f_mntonname)));
	if (sfsp->f_blocks >= sfsp->f_bfree)
		mwp->used = imax(mwp->used, longwidth(fsbtoblk(sfsp->f_blocks -
							       sfsp->f_bfree, sfsp->f_bsize, blocksize, sfsp->f_mntonname)));
	mwp->avail = imax(mwp->avail, longwidth(fsbtoblk(sfsp->f_bavail,
							 sfsp->f_bsize, blocksize, sfsp->f_mntonname)));
	mwp->iused = imax(mwp->iused, longwidth((unsigned)(sfsp->f_files - sfsp->f_ffree)));
	mwp->ifree = imax(mwp->ifree, longwidth((unsigned)(sfsp->f_ffree)));
}
Beispiel #5
0
/*
 * Update the maximum field-width information in `mwp' based on
 * the filesystem specified by `sfsp'.
 */
void
update_maxwidths(struct maxwidths *mwp, struct statfs *sfsp, struct statvfs *vsfsp)
{
    static long blocksize;
    int dummy;

    if (blocksize == 0)
        getbsize(&dummy, &blocksize);

    mwp->mntfrom = imax(mwp->mntfrom, strlen(sfsp->f_mntfromname));
    mwp->total = imax(mwp->total, quadwidth(fsbtoblk(vsfsp->f_blocks,
                                            vsfsp->f_bsize, blocksize)));
    mwp->used = imax(mwp->used, quadwidth(fsbtoblk(vsfsp->f_blocks -
                                          vsfsp->f_bfree, vsfsp->f_bsize, blocksize)));
    mwp->avail = imax(mwp->avail, quadwidth(fsbtoblk(vsfsp->f_bavail,
                                            vsfsp->f_bsize, blocksize)));
    mwp->iused = imax(mwp->iused, quadwidth(vsfsp->f_files -
                                            vsfsp->f_ffree));
    mwp->ifree = imax(mwp->ifree, quadwidth(vsfsp->f_ffree));
}
Beispiel #6
0
/*
 * Print in format defined by POSIX 1002.2, invoke with -P option.
 */
static void
posixprint(struct statfs *mntbuf, long mntsize, int maxwidth)
{
	int i;
	int blocksize;
	char *blockstr;
	struct statfs *sfsp;
	long long used, avail;
	double percentused;

	if (kflag) {
		blocksize = 1024;
		blockstr = "1024-blocks";
	} else {
		blocksize = 512;
		blockstr = " 512-blocks";
	}

	(void)printf(
	    "%-*.*s %s       Used   Available Capacity Mounted on\n",
	    maxwidth, maxwidth, "Filesystem", blockstr);

	for (i = 0; i < mntsize; i++) {
		sfsp = &mntbuf[i];
		used = sfsp->f_blocks - sfsp->f_bfree;
		avail = sfsp->f_bavail + used;
		if (avail == 0)
			percentused = 100.0;
		else
			percentused = (double)used / (double)avail * 100.0;

		(void) printf ("%-*.*s %*lld %10lld %11lld %5.0f%%   %s\n",
			maxwidth, maxwidth, sfsp->f_mntfromname,
			(int)strlen(blockstr),
			fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize),
			fsbtoblk(used, sfsp->f_bsize, blocksize),
			fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, blocksize),
			percentused, sfsp->f_mntonname);
	}
}
Beispiel #7
0
/*
 * Update the maximum field-width information in `mwp' based on
 * the file system specified by `sfsp'.
 */
static void
update_maxwidths(struct maxwidths *mwp, const struct statfs *sfsp)
{
	static long blocksize = 0;
	int dummy;

	if (blocksize == 0)
		getbsize(&dummy, &blocksize);

	mwp->mntfrom = imax(mwp->mntfrom, (int)strlen(sfsp->f_mntfromname));
	mwp->fstype = imax(mwp->fstype, (int)strlen(sfsp->f_fstypename));
	mwp->total = imax(mwp->total, int64width(
	    fsbtoblk((int64_t)sfsp->f_blocks, sfsp->f_bsize, blocksize)));
	mwp->used = imax(mwp->used,
	    int64width(fsbtoblk((int64_t)sfsp->f_blocks -
	    (int64_t)sfsp->f_bfree, sfsp->f_bsize, blocksize)));
	mwp->avail = imax(mwp->avail, int64width(fsbtoblk(sfsp->f_bavail,
	    sfsp->f_bsize, blocksize)));
	mwp->iused = imax(mwp->iused, int64width((int64_t)sfsp->f_files -
	    sfsp->f_ffree));
	mwp->ifree = imax(mwp->ifree, int64width(sfsp->f_ffree));
}
static void update_maxwidths(struct maxWidths *mwp, const struct statfs *sfsp)
{
	static u_long blocksize = 0;
	int dummy;
	
	if(blocksize == 0)
		getbsize(&dummy, &blocksize);
		
	mwp->MountFrom = imax(mwp->MountFrom, (int)strlen(sfsp->f_mntfromname));
	mwp->Total = imax(mwp->Total, int64width( \
		fsbtoblk((int64_t)sfsp->f_blocks, sfsp->f_bsize, blocksize)));
	
	mwp->Used = imax(mwp->Used,	\
	 int64width(fsbtoblk((int64_t)sfsp->f_blocks - 
	 (int64_t)sfsp->f_bfree, sfsp->f_bsize, blocksize)));
	 
	mwp->Available = imax(mwp->Available, int64width(fsbtoblk(sfsp->f_bavail,sfsp->f_bsize, blocksize)));
	
	mwp->I_Used = imax(mwp->I_Used, int64width((int64_t)sfsp->f_files -
	    sfsp->f_ffree));
	
	mwp->I_Free = imax(mwp->I_Free, int64width(sfsp->f_ffree));
}
Beispiel #9
0
/*
 * Print out status about a file system.
 */
static void
prtstat(struct statfs *sfsp, struct maxwidths *mwp)
{
	static long blocksize;
	static int headerlen, timesthrough = 0;
	static const char *header;
	int64_t used, availblks, inodes;

	if (++timesthrough == 1) {
		mwp->mntfrom = imax(mwp->mntfrom, (int)strlen("Filesystem"));
		mwp->fstype = imax(mwp->fstype, (int)strlen("Type"));
		if (hflag) {
			header = "   Size";
			mwp->total = mwp->used = mwp->avail =
			    (int)strlen(header);
		} else {
			header = getbsize(&headerlen, &blocksize);
			mwp->total = imax(mwp->total, headerlen);
		}
		mwp->used = imax(mwp->used, (int)strlen("Used"));
		mwp->avail = imax(mwp->avail, (int)strlen("Avail"));

		(void)printf("%-*s", mwp->mntfrom, "Filesystem");
		if (Tflag)
			(void)printf("  %-*s", mwp->fstype, "Type");
		(void)printf(" %-*s %*s %*s Capacity", mwp->total, header,
		    mwp->used, "Used", mwp->avail, "Avail");
		if (iflag) {
			mwp->iused = imax(hflag ? 0 : mwp->iused,
			    (int)strlen("  iused"));
			mwp->ifree = imax(hflag ? 0 : mwp->ifree,
			    (int)strlen("ifree"));
			(void)printf(" %*s %*s %%iused",
			    mwp->iused - 2, "iused", mwp->ifree, "ifree");
		}
		(void)printf("  Mounted on\n");
	}
	(void)printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname);
	if (Tflag)
		(void)printf("  %-*s", mwp->fstype, sfsp->f_fstypename);
	used = sfsp->f_blocks - sfsp->f_bfree;
	availblks = sfsp->f_bavail + used;
	if (hflag) {
		prthuman(sfsp, used);
	} else {
		(void)printf(" %*jd %*jd %*jd",
		    mwp->total, fsbtoblk(sfsp->f_blocks,
		    sfsp->f_bsize, blocksize),
		    mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize),
		    mwp->avail, fsbtoblk(sfsp->f_bavail,
		    sfsp->f_bsize, blocksize));
	}
	(void)printf(" %5.0f%%",
	    availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
	if (iflag) {
		inodes = sfsp->f_files;
		used = inodes - sfsp->f_ffree;
		if (hflag) {
			(void)printf("  ");
			prthumanvalinode(used);
			prthumanvalinode(sfsp->f_ffree);
		} else {
			(void)printf(" %*jd %*jd", mwp->iused, (intmax_t)used,
			    mwp->ifree, (intmax_t)sfsp->f_ffree);
		}
		(void)printf(" %4.0f%% ", inodes == 0 ? 100.0 :
		    (double)used / (double)inodes * 100.0);
	} else
		(void)printf("  ");
	if (strncmp(sfsp->f_mntfromname, "total", MNAMELEN) != 0)
		(void)printf("  %s", sfsp->f_mntonname);
	(void)printf("\n");
}
Beispiel #10
0
/*
 * Print out status about a filesystem.
 */
void
prtstat(struct statfs *sfsp, struct maxwidths *mwp)
{
	static long blocksize;
	static int headerlen, timesthrough;
	static const char *header;
	uint64_t used, availblks, inodes;
	char * avail_str;

	if (++timesthrough == 1) {
		mwp->mntfrom = imax(mwp->mntfrom, (int)strlen("Filesystem"));
		if (hflag) {
			header = "  Size";
			mwp->total = mwp->used = mwp->avail = (int)strlen(header);
		} else {
			header = getbsize(&headerlen, &blocksize);
			mwp->total = imax(mwp->total, headerlen);
		}
		mwp->used = imax(mwp->used, (int)strlen("Used"));
		if (COMPAT_MODE("bin/df", "unix2003") && !hflag) {
			avail_str = "Available";
		} else {
			avail_str = "Avail";
		}
		mwp->avail = imax(mwp->avail, (int)strlen(avail_str));

		(void)printf("%-*s %*s %*s %*s Capacity", mwp->mntfrom,
		    "Filesystem", mwp->total, header, mwp->used, "Used",
		    mwp->avail, avail_str);
		if (iflag) {
			mwp->iused = imax(mwp->iused, (int)strlen("  iused"));
			mwp->ifree = imax(mwp->ifree, (int)strlen("ifree"));
			(void)printf(" %*s %*s %%iused", mwp->iused - 2,
			    "iused", mwp->ifree, "ifree");
		}
		(void)printf("  Mounted on\n");
	}

	(void)printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname);
	if (sfsp->f_blocks > sfsp->f_bfree)
		used = sfsp->f_blocks - sfsp->f_bfree;
	else
		used = 0;
	availblks = sfsp->f_bavail + used;
	if (hflag) {
		prthuman(sfsp, used);
	} else {
		(void)printf(" %*jd %*jd %*jd", mwp->total,
			     fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize, sfsp->f_mntonname),
			     mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize, sfsp->f_mntonname),
			     mwp->avail, fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, blocksize, sfsp->f_mntonname));
	}
	if (COMPAT_MODE("bin/df", "unix2003")) {
		/* Standard says percentage must be rounded UP to next
		   integer value, not truncated */
		double value;
		if (availblks == 0)
			value = 100.0;
		else {
			value = (double)used / (double)availblks * 100.0;
			if ((value-(int)value) > 0.0) value = value + 1.0;
		}
		(void)printf(" %5.0f%%", trunc(value));
	} else {
		(void)printf(" %5.0f%%",
		    availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
	}
	if (iflag) {
		inodes = sfsp->f_files;
		used = inodes - sfsp->f_ffree;
		(void)printf(" %*llu %*lu %4.0f%% ", mwp->iused, used,
		    mwp->ifree, (unsigned long)sfsp->f_ffree, inodes == 0 ? 100.0 :
		    (double)used / (double)inodes * 100.0);
	} else
		(void)printf("  ");
	(void)printf("  %s\n", sfsp->f_mntonname);
}
Beispiel #11
0
/*
 * Print out status about a file system.
 */
static void
prtstat(struct statfs *sfsp, struct maxwidths *mwp)
{
	static long blocksize;
	static int headerlen, timesthrough = 0;
	static const char *header;
	int64_t used, availblks, inodes;
	const char *format;

	if (++timesthrough == 1) {
		mwp->mntfrom = imax(mwp->mntfrom, (int)strlen("Filesystem"));
		mwp->fstype = imax(mwp->fstype, (int)strlen("Type"));
		if (thousands) {		/* make space for commas */
		    mwp->total += (mwp->total - 1) / 3;
		    mwp->used  += (mwp->used - 1) / 3;
		    mwp->avail += (mwp->avail - 1) / 3;
		    mwp->iused += (mwp->iused - 1) / 3;
		    mwp->ifree += (mwp->ifree - 1) / 3;
		}
		if (hflag) {
			header = "   Size";
			mwp->total = mwp->used = mwp->avail =
			    (int)strlen(header);
		} else {
			header = getbsize(&headerlen, &blocksize);
			mwp->total = imax(mwp->total, headerlen);
		}
		mwp->used = imax(mwp->used, (int)strlen("Used"));
		mwp->avail = imax(mwp->avail, (int)strlen("Avail"));

		(void)printf("%-*s", mwp->mntfrom, "Filesystem");
		if (Tflag)
			(void)printf("  %-*s", mwp->fstype, "Type");
		(void)printf(" %*s %*s %*s Capacity", mwp->total, header,
		    mwp->used, "Used", mwp->avail, "Avail");
		if (iflag) {
			mwp->iused = imax(hflag ? 0 : mwp->iused,
			    (int)strlen("  iused"));
			mwp->ifree = imax(hflag ? 0 : mwp->ifree,
			    (int)strlen("ifree"));
			(void)printf(" %*s %*s %%iused",
			    mwp->iused - 2, "iused", mwp->ifree, "ifree");
		}
		(void)printf("  Mounted on\n");
	}
	/* Check for 0 block size.  Can this happen? */
	if (sfsp->f_bsize == 0) {
		warnx ("File system %s does not have a block size, assuming 512.",
		    sfsp->f_mntonname);
		sfsp->f_bsize = 512;
	}
	(void)printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname);
	if (Tflag)
		(void)printf("  %-*s", mwp->fstype, sfsp->f_fstypename);
	used = sfsp->f_blocks - sfsp->f_bfree;
	availblks = sfsp->f_bavail + used;
	if (hflag) {
		prthuman(sfsp, used);
	} else {
		if (thousands)
		    format = " %*j'd %*j'd %*j'd";
		else
		    format = " %*jd %*jd %*jd";
		(void)printf(format,
		    mwp->total, fsbtoblk(sfsp->f_blocks,
		    sfsp->f_bsize, blocksize),
		    mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize),
		    mwp->avail, fsbtoblk(sfsp->f_bavail,
		    sfsp->f_bsize, blocksize));
	}
	(void)printf(" %5.0f%%",
	    availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
	if (iflag) {
		inodes = sfsp->f_files;
		used = inodes - sfsp->f_ffree;
		if (hflag) {
			(void)printf("  ");
			prthumanvalinode(used);
			prthumanvalinode(sfsp->f_ffree);
		} else {
			if (thousands)
			    format = " %*j'd %*j'd";
			else
			    format = " %*jd %*jd";
			(void)printf(format, mwp->iused, (intmax_t)used,
			    mwp->ifree, (intmax_t)sfsp->f_ffree);
		}
		(void)printf(" %4.0f%% ", inodes == 0 ? 100.0 :
		    (double)used / (double)inodes * 100.0);
	} else
		(void)printf("  ");
	if (strncmp(sfsp->f_mntfromname, "total", MNAMELEN) != 0)
		(void)printf("  %s", sfsp->f_mntonname);
	(void)printf("\n");
}
Beispiel #12
0
/*
 * Print out status about a filesystem.
 */
static void
prtstat(struct statvfs *sfsp, int maxwidth)
{
	static long blocksize;
	static int headerlen, timesthrough;
	static const char *header;
	static const char full[] = "100";
	static const char empty[] = "  0";
	int64_t used, availblks, inodes;
	int64_t bavail;
	char pb[64];

	if (gflag) {
		/*
		 * From SunOS-5.6:
		 *
		 * /var               (/dev/dsk/c0t0d0s3 ):         8192 block size          1024 frag size
		 *   984242 total blocks     860692 free blocks   859708 available         249984 total files
		 *   248691 free files      8388611 filesys id
		 *      ufs fstype       0x00000004 flag             255 filename length
		 *
		 */
		(void)printf("%10s (%-12s): %7ld block size %12ld frag size\n",
		    sfsp->f_mntonname, sfsp->f_mntfromname,
		    sfsp->f_bsize,	/* On UFS/FFS systems this is
					 * also called the "optimal
					 * transfer block size" but it
					 * is of course the file
					 * system's block size too.
					 */
		    sfsp->f_frsize);	/* not so surprisingly the
					 * "fundamental file system
					 * block size" is the frag
					 * size.
					 */
		(void)printf("%10" PRId64 " total blocks %10" PRId64
		    " free blocks  %10" PRId64 " available\n",
		    (uint64_t)sfsp->f_blocks, (uint64_t)sfsp->f_bfree,
		    (uint64_t)sfsp->f_bavail);
		(void)printf("%10" PRId64 " total files  %10" PRId64
		    " free files %12lx filesys id\n",
		    (uint64_t)sfsp->f_ffree, (uint64_t)sfsp->f_files,
		    sfsp->f_fsid);
		(void)printf("%10s fstype  %#15lx flag  %17ld filename "
		    "length\n", sfsp->f_fstypename, sfsp->f_flag,
		    sfsp->f_namemax);
		(void)printf("%10lu owner %17" PRId64 " syncwrites %12" PRId64
		    " asyncwrites\n\n", (unsigned long)sfsp->f_owner,
		    sfsp->f_syncwrites, sfsp->f_asyncwrites);

		/*
		 * a concession by the structured programming police to the
		 * indentation police....
		 */
		return;
	}
	if (maxwidth < 12)
		maxwidth = 12;
	if (++timesthrough == 1) {
		switch (blocksize = usize) {
		case 1024:
			header = Pflag ? "1024-blocks" : "1K-blocks";
			headerlen = (int)strlen(header);
			break;
		case 1024 * 1024:
			header = "1M-blocks";
			headerlen = (int)strlen(header);
			break;
		case 1024 * 1024 * 1024:
			header = "1G-blocks";
			headerlen = (int)strlen(header);
			break;
		default:
			if (hflag) {
				header = "Size";
				headerlen = (int)strlen(header);
			} else
				header = getbsize(&headerlen, &blocksize);
			break;
		}
		if (Pflag) {
			/*
			 * either:
			 *  "Filesystem 1024-blocks Used Available Capacity Mounted on\n"
			 * or:
			 *  "Filesystem 512-blocks Used Available Capacity Mounted on\n"
			 */
			if (blocksize != 1024 && blocksize != 512)
				errx(EXIT_FAILURE,
				    "non-standard block size incompatible with -P");
			(void)printf("Filesystem %s Used Available Capacity "
			    "Mounted on\n", header);
		} else {
			(void)printf("%-*.*s %s       Used      Avail %%Cap",
			    maxwidth - (headerlen - 10),
			    maxwidth - (headerlen - 10),
			    "Filesystem", header);
			if (iflag)
				(void)printf("    iUsed   iAvail %%iCap");
			(void)printf(" Mounted on\n");
		}
	}
	used = sfsp->f_blocks - sfsp->f_bfree;
	bavail = sfsp->f_bfree - sfsp->f_bresvd;
	availblks = bavail + used;
	if (Pflag) {
		assert(hflag == 0);
		assert(blocksize > 0);
		/*
		 * "%s %d %d %d %s %s\n", <file system name>, <total space>,
		 * <space used>, <space free>, <percentage used>,
		 * <file system root>
		 */
		(void)printf("%s %" PRId64 " %" PRId64 " %" PRId64 " %s%% %s\n",
		    sfsp->f_mntfromname,
		    fsbtoblk(sfsp->f_blocks, sfsp->f_frsize, blocksize),
		    fsbtoblk(used, sfsp->f_frsize, blocksize),
		    fsbtoblk(bavail, sfsp->f_frsize, blocksize),
		    availblks == 0 ? full : strspct(pb, sizeof(pb), used,
		    availblks, 0), sfsp->f_mntonname);
		/*
		 * another concession by the structured programming police to
		 * the indentation police....
		 *
		 * Note iflag cannot be set when Pflag is set.
		 */
		return;
	}

	(void)printf("%-*.*s ", maxwidth, maxwidth, sfsp->f_mntfromname);

	if (hflag)
		prthuman(sfsp, used, bavail);
	else
		(void)printf("%10" PRId64 " %10" PRId64 " %10" PRId64,
		    fsbtoblk(sfsp->f_blocks, sfsp->f_frsize, blocksize),
		    fsbtoblk(used, sfsp->f_frsize, blocksize),
		    fsbtoblk(bavail, sfsp->f_frsize, blocksize));
	(void)printf(" %3s%%",
	    availblks == 0 ? full :
	    strspct(pb, sizeof(pb), used, availblks, 0));
	if (iflag) {
		inodes = sfsp->f_files;
		used = inodes - sfsp->f_ffree;
		(void)printf(" %8jd %8jd %4s%%",
		    (intmax_t)used, (intmax_t)sfsp->f_ffree,
		    inodes == 0 ? (used == 0 ? empty : full) :
		    strspct(pb, sizeof(pb), used, inodes, 0));
	}
	(void)printf(" %s\n", sfsp->f_mntonname);
}