Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Nov 2011 22:56:30 +0100
From:      Ed Schouten <ed@80386.nl>
To:        Alexander Best <arundel@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r227164 - head/usr.bin/du
Message-ID:  <20111106215630.GQ2258@hoeg.nl>
In-Reply-To: <20111106204619.GA76768@freebsd.org>
References:  <201111060815.pA68FIvC008341@svn.freebsd.org> <20111106204619.GA76768@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Rnz0oC2K6vQ5doJs
Content-Type: multipart/mixed; boundary="zOr5JpMIiGv/Oaxu"
Content-Disposition: inline


--zOr5JpMIiGv/Oaxu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Alexander,

* Alexander Best <arundel@freebsd.org>, 20111106 21:46:
> this diff was flying around in my /usr/src, which makes some code a bit m=
ore
> readable. maybe this is something worth having in HEAD?

Looks good. It seems we can also get rid of the `listall' variable here.
The rest of the code also uses the `*flag' variables, so there's no
reason why we can't just use `aflag'. Does this patch look good to you?

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--zOr5JpMIiGv/Oaxu
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="du.c.diff"
Content-Transfer-Encoding: quoted-printable

Index: usr.bin/du/du.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- usr.bin/du/du.c	(revision 227263)
+++ usr.bin/du/du.c	(working copy)
@@ -88,7 +88,6 @@
 	off_t		savednumber, curblocks;
 	off_t		threshold, threshold_sign;
 	int		ftsoptions;
-	int		listall;
 	int		depth;
 	int		Hflag, Lflag, Pflag, aflag, sflag, dflag, cflag;
 	int		hflag, lflag, ch, notused, rval;
@@ -229,17 +228,10 @@
 	if (!Aflag && (cblocksize % DEV_BSIZE) !=3D 0)
 		cblocksize =3D howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE;
=20
-	listall =3D 0;
-
-	if (aflag) {
-		if (sflag || dflag)
-			usage();
-		listall =3D 1;
-	} else if (sflag) {
-		if (dflag)
-			usage();
+	if (aflag + dflag + sflag > 1)
+		usage();
+	if (sflag)
 		depth =3D 0;
-	}
=20
 	if (!*argv) {
 		argv =3D save;
@@ -320,7 +312,7 @@
 			    howmany(p->fts_statp->st_size, cblocksize) :
 			    howmany(p->fts_statp->st_blocks, cblocksize);
=20
-			if (listall || p->fts_level =3D=3D 0) {
+			if (aflag || p->fts_level =3D=3D 0) {
 				if (hflag) {
 					prthumanval(curblocks);
 					(void)printf("\t%s\n", p->fts_path);

--zOr5JpMIiGv/Oaxu--

--Rnz0oC2K6vQ5doJs
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iQIcBAEBAgAGBQJOtwKNAAoJEG5e2P40kaK7jiYP/Re7g7MrZjZgLUJEbFWPxXyD
tUlF/2DXlniMbaQtxAujmzdNUe5eIAnULlqyeHJLE20GqQBqo3ML0sX8RReeAcSt
FErf/ZD6s4+RDPhYFKr+/0ZoPKh+bW1qQzJ7y7igE/mo6mrUNheyvAXuEXTV6ua5
nWkNLEnxFO6nUj3LeclPrC1pPfTvvWPn/ZMCJv9giEya7cy32BsuLmT6s+Z8yOI5
2T88gO0IdWQImTNF3hur57OCnVx405xrBFX830udrAL3uTr+lnWq+Zkdl5AH+elv
hHCqnlj2U/H03HOGmbMku216FRWWQ0acBPBEfFPbXIfCq8Snw1NZ4C3+PbgFOJQ3
YOYqS6Mhz//QTw8nlBCgo6ipZxuHdN28f7FeufzxN+FfbX1bYQoOG40kbw5x5n+t
1X3O+jLKkLqkUy2hPuEbEeh+LuGZbNafXoWJQrxBmX6xNaAXJcrkxWUvZ57yWLRr
EawUXT1fUx6l5H3eSZZu5lLwN0L5+D3C8XdjIheXPyCvwQTjmFGHv/SLy8l71rLi
mh81jOheUzp9STbcELALXWPYGwrGeyg4abvA3oDmCqRPY7OsdTrmtxmE2xRrN3VZ
WaPU0LhAxT2xZFwNVY+5wd6D7+Q7Pnb3XPd5C51aZYXg+uiTHafM997C5htQJxVn
qLY9VRXYK6a8qaYj0hfW
=JIA4
-----END PGP SIGNATURE-----

--Rnz0oC2K6vQ5doJs--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111106215630.GQ2258>