svn commit: r184654 - head/usr.bin/du

Max Laier mlaier at FreeBSD.org
Tue Nov 4 11:17:32 PST 2008


Author: mlaier
Date: Tue Nov  4 19:17:32 2008
New Revision: 184654
URL: http://svn.freebsd.org/changeset/base/184654

Log:
  style(9): mostly avoiding line wrap by not indenting cases.  No obj change.

Modified:
  head/usr.bin/du/du.c

Modified: head/usr.bin/du/du.c
==============================================================================
--- head/usr.bin/du/du.c	Tue Nov  4 19:13:53 2008	(r184653)
+++ head/usr.bin/du/du.c	Tue Nov  4 19:17:32 2008	(r184654)
@@ -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);
-				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);
-					}
+		case FTS_D:			/* Ignore. */
+			if (ignorep(p))
+				fts_set(fts, p, FTS_SKIP);
+			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) {
+					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;
-
-				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);
-					}
+			}
+			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;
+
+			if (lflag == 0 && p->fts_statp->st_nlink > 1 &&
+			    linkchk(p))
+				break;
+
+			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) {


More information about the svn-src-all mailing list