summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>2000-03-26 14:21:57 +0000
committercharnier <charnier@FreeBSD.org>2000-03-26 14:21:57 +0000
commitf717c07c8ab962df0e0a56b28e7f917c1b89dd1a (patch)
tree892668dab5f3c9576643456cde0d8d607237fb10 /usr.bin
parente49a6026c4516114efbe71ef3f28df8ce891b6bc (diff)
downloadFreeBSD-src-f717c07c8ab962df0e0a56b28e7f917c1b89dd1a.zip
FreeBSD-src-f717c07c8ab962df0e0a56b28e7f917c1b89dd1a.tar.gz
Use warnx(), -Wall cleaning and remove unused #include
Better use of .Nm and .Ar
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/du/du.110
-rw-r--r--usr.bin/du/du.c17
2 files changed, 15 insertions, 12 deletions
diff --git a/usr.bin/du/du.1 b/usr.bin/du/du.1
index fedd012..1eb3fd0 100644
--- a/usr.bin/du/du.1
+++ b/usr.bin/du/du.1
@@ -45,10 +45,10 @@
.Op Fl c
.Op Fl h | k
.Op Fl x
-.Op Ar file ...
+.Op Ar
.Sh DESCRIPTION
The
-.Nm du
+.Nm
utility displays the file system block usage for each file argument
and for each directory in the file hierarchy rooted in each directory
argument.
@@ -63,7 +63,7 @@ is used to determine the preferred block size.
Partial numbers of blocks are rounded up.
.Pp
The options are as follows:
-.Bl -tag -width Ds
+.Bl -tag -width indent
.It Fl P
No symbolic links are followed.
(default)
@@ -115,7 +115,7 @@ followed is not counted or displayed.
.Pp
Files having multiple hard links are counted (and displayed) a single
time per
-.Nm du
+.Nm
execution.
.Sh ENVIRONMENT
.Bl -tag -width BLOCKSIZE
@@ -138,6 +138,6 @@ option is not specified, the block counts will be displayed in 512-byte blocks.
.Xr quot 8
.Sh HISTORY
A
-.Nm du
+.Nm
command appeared in
.At v1 .
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 9500a1b..f2f7ad4 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -44,14 +44,14 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)du.c 8.5 (Berkeley) 5/4/95";
#endif
-static const char rcsid[] = "$FreeBSD$";
+static const char rcsid[] =
+ "$FreeBSD$";
#endif /* not lint */
#include <sys/param.h>
#include <sys/stat.h>
-#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <fts.h>
@@ -139,7 +139,7 @@ main(argc, argv)
errno = 0;
depth = atoi(optarg);
if (errno == ERANGE || depth < 0) {
- (void) fprintf(stderr, "Invalid argument to option d: %s\n", optarg);
+ warnx("invalid argument to option d: %s", optarg);
usage();
}
break;
@@ -229,7 +229,7 @@ main(argc, argv)
p->fts_parent->fts_number +=
p->fts_number += p->fts_statp->st_blocks;
- if (p->fts_level <= depth)
+ if (p->fts_level <= depth) {
if (hflag) {
(void) prthumanval(howmany(p->fts_number, blocksize));
(void) printf("\t%s\n", p->fts_path);
@@ -238,6 +238,7 @@ main(argc, argv)
howmany(p->fts_number, blocksize),
p->fts_path);
}
+ }
break;
case FTS_DC: /* Ignore. */
break;
@@ -251,7 +252,7 @@ main(argc, argv)
if (p->fts_statp->st_nlink > 1 && linkchk(p))
break;
- if (listall || p->fts_level == 0)
+ if (listall || p->fts_level == 0) {
if (hflag) {
(void) prthumanval(howmany(p->fts_statp->st_blocks,
blocksize));
@@ -261,6 +262,7 @@ main(argc, argv)
howmany(p->fts_statp->st_blocks, blocksize),
p->fts_path);
}
+ }
p->fts_parent->fts_number += p->fts_statp->st_blocks;
}
@@ -270,13 +272,14 @@ main(argc, argv)
if (errno)
err(1, "fts_read");
- if (cflag)
+ if (cflag) {
if (hflag) {
(void) prthumanval(howmany(savednumber, blocksize));
(void) printf("\ttotal\n");
} else {
(void) printf("%ld\ttotal\n", howmany(savednumber, blocksize));
}
+ }
exit(rval);
}
@@ -307,7 +310,7 @@ linkchk(p)
if (nfiles == maxfiles && (files = realloc((char *)files,
(u_int)(sizeof(ID) * (maxfiles += 128)))) == NULL)
- err(1, "can't allocate memory");
+ errx(1, "can't allocate memory");
files[nfiles].inode = ino;
files[nfiles].dev = dev;
++nfiles;
OpenPOWER on IntegriCloud