Project

General

Profile

Submit #2600 » 0003-Add-T-option-to-df-1.patch

rolinh, 10/25/2013 01:39 AM

View differences:

bin/df/df.1
.Fl b | h | H | k |
.Fl m | P
.Oc
.Op Fl ailn
.Op Fl ailnT
.Op Fl t Ar type
.Op Ar file | filesystem ...
.Sh DESCRIPTION
......
.Xr lsvfs 1
command can be used to find out the types of file systems
that are available on the system.
.It Fl T
Include file system type.
.El
.Sh ENVIRONMENT
.Bl -tag -width BLOCKSIZE
bin/df/df.c
/* Maximum widths of various fields. */
struct maxwidths {
int mntfrom;
int fstype;
int total;
int used;
int avail;
......
static void update_maxwidths(struct maxwidths *, struct statfs *, struct statvfs *);
static void usage(void);
int aflag = 0, hflag, iflag, nflag;
int aflag = 0, hflag, iflag, nflag, Tflag;
struct ufs_args mdev;
static __inline int
......
fstype = "ufs";
vfslist = NULL;
while ((ch = getopt(argc, argv, "abgHhiklmnPt:")) != -1)
while ((ch = getopt(argc, argv, "abgHhiklmnPt:T")) != -1)
switch (ch) {
case 'a':
aflag = 1;
......
fstype = optarg;
vfslist = makevfslist(optarg);
break;
case 'T':
Tflag = 1;
break;
case '?':
default:
usage();
......
if (++timesthrough == 1) {
mwp->mntfrom = imax(mwp->mntfrom, strlen("Filesystem"));
mwp->fstype = imax(mwp->fstype, strlen("Type"));
if (hflag) {
header = " Size";
mwp->total = mwp->used = mwp->avail = strlen(header);
......
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");
printf("%-*s", mwp->mntfrom, "Filesystem");
if (Tflag)
printf(" %-*s", mwp->fstype, "Type");
printf(" %-*s %*s %*s Capacity", 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(" Mounted on\n");
}
printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname);
if (Tflag)
printf(" %-*s", mwp->fstype, sfsp->f_fstypename);
used = vsfsp->f_blocks - vsfsp->f_bfree;
availblks = vsfsp->f_bavail + used;
if (hflag) {
......
getbsize(&dummy, &blocksize);
mwp->mntfrom = imax(mwp->mntfrom, strlen(sfsp->f_mntfromname));
mwp->fstype = imax(mwp->fstype, strlen(sfsp->f_fstypename));
mwp->total = imax(mwp->total, quadwidth(fsbtoblk(vsfsp->f_blocks,
vsfsp->f_bsize, blocksize)));
mwp->used = imax(mwp->used, quadwidth(fsbtoblk(vsfsp->f_blocks -
......
{
fprintf(stderr,
"usage: df [-b | -H | -h | -k | -m | -P] [-ailn] [-t type] [file | filesystem ...]\n");
"usage: df [-b | -H | -h | -k | -m | -P] [-ailnT] [-t type] [file | filesystem ...]\n");
exit(EX_USAGE);
}
(3-3/4)