Hi Alexander, * Alexander Best <arun...@freebsd.org>, 20111106 21:46: > this diff was flying around in my /usr/src, which makes some code a bit more > 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? -- Ed Schouten <e...@80386.nl> WWW: http://80386.nl/
Index: usr.bin/du/du.c =================================================================== --- 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) != 0) cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE; - listall = 0; - - if (aflag) { - if (sflag || dflag) - usage(); - listall = 1; - } else if (sflag) { - if (dflag) - usage(); + if (aflag + dflag + sflag > 1) + usage(); + if (sflag) depth = 0; - } if (!*argv) { argv = save; @@ -320,7 +312,7 @@ howmany(p->fts_statp->st_size, cblocksize) : howmany(p->fts_statp->st_blocks, cblocksize); - if (listall || p->fts_level == 0) { + if (aflag || p->fts_level == 0) { if (hflag) { prthumanval(curblocks); (void)printf("\t%s\n", p->fts_path);
pgp9aSTGBYZl8.pgp
Description: PGP signature