summaryrefslogtreecommitdiffstats
path: root/usr.bin/du
diff options
context:
space:
mode:
authormlaier <mlaier@FreeBSD.org>2008-11-04 19:17:32 +0000
committermlaier <mlaier@FreeBSD.org>2008-11-04 19:17:32 +0000
commitda7287b624d8d67a7eedfbae0c662682bc1bd90c (patch)
tree43aa9cc90ec915e1847745b527735461df9cef12 /usr.bin/du
parentbfd6c884ce5ae926b3c5ac3e9fad8430de595c55 (diff)
downloadFreeBSD-src-da7287b624d8d67a7eedfbae0c662682bc1bd90c.zip
FreeBSD-src-da7287b624d8d67a7eedfbae0c662682bc1bd90c.tar.gz
style(9): mostly avoiding line wrap by not indenting cases. No obj change.
Diffstat (limited to 'usr.bin/du')
-rw-r--r--usr.bin/du/du.c235
1 files changed, 121 insertions, 114 deletions
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 8959293..1c242f7 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -85,7 +85,7 @@ main(int argc, char *argv[])
{
FTS *fts;
FTSENT *p;
- off_t savednumber = 0;
+ off_t savednumber;
long blocksize;
int ftsoptions;
int listall;
@@ -102,75 +102,77 @@ main(int argc, char *argv[])
save = argv;
ftsoptions = 0;
+ savednumber = 0;
depth = INT_MAX;
SLIST_INIT(&ignores);
while ((ch = getopt(argc, argv, "HI:LPasd:chklmnrx")) != -1)
switch (ch) {
- case 'H':
- Hflag = 1;
- break;
- case 'I':
- ignoreadd(optarg);
- break;
- case 'L':
- if (Pflag)
- usage();
- Lflag = 1;
- break;
- case 'P':
- if (Lflag)
- usage();
- Pflag = 1;
- break;
- case 'a':
- aflag = 1;
- break;
- case 's':
- sflag = 1;
- break;
- case 'd':
- dflag = 1;
- errno = 0;
- depth = atoi(optarg);
- if (errno == ERANGE || depth < 0) {
- warnx("invalid argument to option d: %s", optarg);
- usage();
- }
- break;
- case 'c':
- cflag = 1;
- break;
- case 'h':
- if (setenv("BLOCKSIZE", "512", 1) == -1)
- warn(
- "setenv: cannot set BLOCKSIZE=512");
- hflag = 1;
- break;
- case 'k':
- hflag = 0;
- if (setenv("BLOCKSIZE", "1024", 1) == -1)
- warn("setenv: cannot set BLOCKSIZE=1024");
- break;
- case 'l':
- lflag = 1;
- break;
- case 'm':
- hflag = 0;
- if (setenv("BLOCKSIZE", "1048576", 1) == -1)
- warn("setenv: cannot set BLOCKSIZE=1048576");
- break;
- case 'n':
- nodumpflag = 1;
- break;
- case 'r': /* Compatibility. */
- break;
- case 'x':
- ftsoptions |= FTS_XDEV;
- break;
- case '?':
- default:
+ case 'H':
+ Hflag = 1;
+ break;
+ case 'I':
+ ignoreadd(optarg);
+ break;
+ case 'L':
+ if (Pflag)
+ usage();
+ Lflag = 1;
+ break;
+ case 'P':
+ if (Lflag)
usage();
+ Pflag = 1;
+ break;
+ case 'a':
+ aflag = 1;
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ errno = 0;
+ depth = atoi(optarg);
+ if (errno == ERANGE || depth < 0) {
+ warnx("invalid argument to option d: %s",
+ optarg);
+ usage();
+ }
+ break;
+ case 'c':
+ cflag = 1;
+ break;
+ case 'h':
+ if (setenv("BLOCKSIZE", "512", 1) == -1)
+ warn("setenv: cannot set BLOCKSIZE=512");
+ hflag = 1;
+ break;
+ case 'k':
+ hflag = 0;
+ if (setenv("BLOCKSIZE", "1024", 1) == -1)
+ warn("setenv: cannot set BLOCKSIZE=1024");
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+ case 'm':
+ hflag = 0;
+ if (setenv("BLOCKSIZE", "1048576", 1) == -1)
+ warn("setenv: cannot set BLOCKSIZE=1048576");
+ break;
+ case 'n':
+ nodumpflag = 1;
+ break;
+ case 'r': /* Compatibility. */
+ break;
+ case 'x':
+ ftsoptions |= FTS_XDEV;
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
}
argc -= optind;
@@ -222,7 +224,7 @@ main(int argc, char *argv[])
argv[1] = NULL;
}
- (void) getbsize(&notused, &blocksize);
+ (void)getbsize(&notused, &blocksize);
blocksize /= 512;
rval = 0;
@@ -232,57 +234,60 @@ main(int argc, char *argv[])
while ((p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
- case FTS_D: /* Ignore. */
- if (ignorep(p))
- fts_set(fts, p, FTS_SKIP);
+ case FTS_D: /* Ignore. */
+ if (ignorep(p))
+ fts_set(fts, p, FTS_SKIP);
+ break;
+ case FTS_DP:
+ if (ignorep(p))
break;
- case FTS_DP:
- if (ignorep(p))
- break;
-
- p->fts_parent->fts_bignum +=
- p->fts_bignum += p->fts_statp->st_blocks;
-
- if (p->fts_level <= depth) {
- if (hflag) {
- (void) prthumanval(howmany(p->fts_bignum, blocksize));
- (void) printf("\t%s\n", p->fts_path);
- } else {
- (void) printf("%jd\t%s\n",
- (intmax_t)howmany(p->fts_bignum, blocksize),
- p->fts_path);
- }
+
+ p->fts_parent->fts_bignum += p->fts_bignum +=
+ p->fts_statp->st_blocks;
+
+ if (p->fts_level <= depth) {
+ if (hflag) {
+ prthumanval(howmany(p->fts_bignum,
+ blocksize));
+ (void)printf("\t%s\n", p->fts_path);
+ } else {
+ (void)printf("%jd\t%s\n",
+ (intmax_t)howmany(p->fts_bignum,
+ blocksize), p->fts_path);
}
+ }
+ break;
+ case FTS_DC: /* Ignore. */
+ break;
+ case FTS_DNR: /* Warn, continue. */
+ case FTS_ERR:
+ case FTS_NS:
+ warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
+ rval = 1;
+ break;
+ default:
+ if (ignorep(p))
break;
- case FTS_DC: /* Ignore. */
- break;
- case FTS_DNR: /* Warn, continue. */
- case FTS_ERR:
- case FTS_NS:
- warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
- rval = 1;
+
+ if (lflag == 0 && p->fts_statp->st_nlink > 1 &&
+ linkchk(p))
break;
- default:
- if (ignorep(p))
- break;
-
- if (lflag == 0 &&
- p->fts_statp->st_nlink > 1 && linkchk(p))
- break;
-
- if (listall || p->fts_level == 0) {
- if (hflag) {
- (void) prthumanval(howmany(p->fts_statp->st_blocks,
- blocksize));
- (void) printf("\t%s\n", p->fts_path);
- } else {
- (void) printf("%jd\t%s\n",
- (intmax_t)howmany(p->fts_statp->st_blocks, blocksize),
- p->fts_path);
- }
+
+ if (listall || p->fts_level == 0) {
+ if (hflag) {
+ prthumanval(howmany(
+ p->fts_statp->st_blocks,
+ blocksize));
+ (void)printf("\t%s\n", p->fts_path);
+ } else {
+ (void)printf("%jd\t%s\n",
+ (intmax_t)howmany(
+ p->fts_statp->st_blocks,
+ blocksize), p->fts_path);
}
+ }
- p->fts_parent->fts_bignum += p->fts_statp->st_blocks;
+ p->fts_parent->fts_bignum += p->fts_statp->st_blocks;
}
savednumber = p->fts_parent->fts_bignum;
}
@@ -292,10 +297,11 @@ main(int argc, char *argv[])
if (cflag) {
if (hflag) {
- (void) prthumanval(howmany(savednumber, blocksize));
- (void) printf("\ttotal\n");
+ prthumanval(howmany(savednumber, blocksize));
+ (void)printf("\ttotal\n");
} else {
- (void) printf("%jd\ttotal\n", (intmax_t)howmany(savednumber, blocksize));
+ (void)printf("%jd\ttotal\n", (intmax_t)howmany(
+ savednumber, blocksize));
}
}
@@ -348,7 +354,8 @@ linkchk(FTSENT *p)
free_list = le->next;
free(le);
}
- new_buckets = malloc(new_size * sizeof(new_buckets[0]));
+ new_buckets = malloc(new_size *
+ sizeof(new_buckets[0]));
}
if (new_buckets == NULL) {
OpenPOWER on IntegriCloud