History log of /openbsd-current/usr.bin/du/du.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.33 04-Dec-2022 cheloha

userspace: remove vestigial '?' cases from top-level getopt(3) loops

getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument. We can
handle this case with the "default" failure case with no loss of
legibility. Hence, remove all the redundant "case '?':" lines.

Prompted by dlg@. With help from dlg@ and millert@.

Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2

ok naddy@ millert@ dlg@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.32 24-Aug-2016 guenther

Convert quad_t to int64_t and %q to %ll
Convert bzero() to memset() and bcopy() to memcpy()

ok natano@ millert@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.31 10-Oct-2015 deraadt

pledge to only use "stdio rpath"; ok doug


Revision tags: OPENBSD_5_8_BASE
# 1.30 25-Jun-2015 uebayasi

Put fts_close() where missing.

Not bugs in short-lived commands that call exit() -> _exit() immediately,
but for idempotency.

Originally found in ls(1) by Valgrind. Changes for other commands are
from deraadt@. Reviewed by me, tested in snapshots.

OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.29 20-Oct-2014 schwarze

fix a regression that i caused in rev. 1.26: *do* report the size of
files listed on the command line, no matter what options are given;
issue reported by edd@; ok millert@ edd@


# 1.28 19-Oct-2014 jmc

rearrange -d, again, after giving ingo some dodgy advice;
ok ingo


# 1.27 19-Oct-2014 schwarze

in usage() and SYNOPSIS, sort options as suggested by jmc@


# 1.26 17-Oct-2014 schwarze

Add the -d flag (limit display depth) for compatibility with FreeBSD,
DragonFly, NetBSD and GNU coreutils, even though it's not POSIX.
Actually, this simplifies the code rather than complicating it.

Because -a and -d need not be mutually exclusive (as observed by
millert@) and -s is identical to -d 0, -a and -s are no longer
mutually exclusive, but -as and -sa are now the same as -s.
That is explicitly allowed by POSIX.

Based on a patch from William Orr <will at worrbase dot com>,
but extensively massaged and HISTORY added by me.

feedback and ok millert@


Revision tags: OPENBSD_5_6_BASE
# 1.25 20-May-2014 guenther

Use errc/warnc to simplify code.
Also, in 'ftp', always put the error message last, after the hostname/ipaddr.

ok jsing@ krw@ millert@


Revision tags: OPENBSD_5_5_BASE
# 1.24 13-Nov-2013 deraadt

a few things can be static to avoid need for protos


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.23 27-Apr-2011 sobrado

cast one blocksize occurrence to unsigned long, fixes du(1)'s output
for directories larger than one terabyte; while here, wrap a long line.

problem found by Chano Antuna and diff written with lots of good
advice from millert@, thanks!

ok millert@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.21 27-Aug-2009 millert

Use FTS_ROOTLEVEL instead of 0 when checking fts_level.


Revision tags: OPENBSD_4_6_BASE
# 1.20 03-Jun-2009 millert

If both -h and -k are specified, the latter takes precedence.
Prompted by jmc@, OK otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.19 25-Jan-2006 tedu

lint says Pflag isn't needed. i concur


Revision tags: OPENBSD_3_8_BASE
# 1.18 17-Apr-2005 jmc

sort options + sync usage();


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.17 21-Jun-2004 otto

Actually commit right (r&b tree) version, instead of hash table
one. Previous commit from wrong tree. Spotted by Andre Lucas <andre
at ae-35 dot com> ok millert@ canacar@


# 1.16 14-Jun-2004 otto

- use fmt_scaled(3) instead of home grown function to print -h numbers
- do not use a linear list to keep track of inodes with link count > 2,
use a red & black tree. Based on freebsd code that uses auto-sizing
hash maps; this tree version by canacar@.

ok millert@ canacar@


# 1.15 02-Jun-2004 tom

Don't want text in err() call following malloc failures.

ok henning@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.14 02-Jul-2003 deraadt

protos


# 1.13 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.12 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.11 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.10 30-Jul-2001 deraadt

fix 0B case; morten@hotpost.dk


# 1.9 12-Jul-2001 deraadt

first pass at a -Wall cleanup


# 1.8 02-May-2001 pjanzen

-h overrides BLOCKSIZE; matt@anzen.com


Revision tags: OPENBSD_2_9_BASE
# 1.7 23-Feb-2001 pjanzen

Add -h option ("human-readable") as df. Based on suggestions and code from
Matt Bing <matt@anzen.com>.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.6 16-Apr-2000 ericj

correct return value; from FreeBSD


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.5 16-Feb-1998 deraadt

-r for xpg conformance


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.3 18-Oct-1996 millert

Implement a -c (Grand Total) option, a'la GNU du(1).
From Luke Mewburn <lukem@telstra.com.au>, NetBSD PR #2805.
Also -Wall happiness.


Revision tags: OPENBSD_2_0_BASE
# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.32 24-Aug-2016 guenther

Convert quad_t to int64_t and %q to %ll
Convert bzero() to memset() and bcopy() to memcpy()

ok natano@ millert@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.31 10-Oct-2015 deraadt

pledge to only use "stdio rpath"; ok doug


Revision tags: OPENBSD_5_8_BASE
# 1.30 25-Jun-2015 uebayasi

Put fts_close() where missing.

Not bugs in short-lived commands that call exit() -> _exit() immediately,
but for idempotency.

Originally found in ls(1) by Valgrind. Changes for other commands are
from deraadt@. Reviewed by me, tested in snapshots.

OK deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.29 20-Oct-2014 schwarze

fix a regression that i caused in rev. 1.26: *do* report the size of
files listed on the command line, no matter what options are given;
issue reported by edd@; ok millert@ edd@


# 1.28 19-Oct-2014 jmc

rearrange -d, again, after giving ingo some dodgy advice;
ok ingo


# 1.27 19-Oct-2014 schwarze

in usage() and SYNOPSIS, sort options as suggested by jmc@


# 1.26 17-Oct-2014 schwarze

Add the -d flag (limit display depth) for compatibility with FreeBSD,
DragonFly, NetBSD and GNU coreutils, even though it's not POSIX.
Actually, this simplifies the code rather than complicating it.

Because -a and -d need not be mutually exclusive (as observed by
millert@) and -s is identical to -d 0, -a and -s are no longer
mutually exclusive, but -as and -sa are now the same as -s.
That is explicitly allowed by POSIX.

Based on a patch from William Orr <will at worrbase dot com>,
but extensively massaged and HISTORY added by me.

feedback and ok millert@


Revision tags: OPENBSD_5_6_BASE
# 1.25 20-May-2014 guenther

Use errc/warnc to simplify code.
Also, in 'ftp', always put the error message last, after the hostname/ipaddr.

ok jsing@ krw@ millert@


Revision tags: OPENBSD_5_5_BASE
# 1.24 13-Nov-2013 deraadt

a few things can be static to avoid need for protos


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.23 27-Apr-2011 sobrado

cast one blocksize occurrence to unsigned long, fixes du(1)'s output
for directories larger than one terabyte; while here, wrap a long line.

problem found by Chano Antuna and diff written with lots of good
advice from millert@, thanks!

ok millert@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.21 27-Aug-2009 millert

Use FTS_ROOTLEVEL instead of 0 when checking fts_level.


Revision tags: OPENBSD_4_6_BASE
# 1.20 03-Jun-2009 millert

If both -h and -k are specified, the latter takes precedence.
Prompted by jmc@, OK otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.19 25-Jan-2006 tedu

lint says Pflag isn't needed. i concur


Revision tags: OPENBSD_3_8_BASE
# 1.18 17-Apr-2005 jmc

sort options + sync usage();


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.17 21-Jun-2004 otto

Actually commit right (r&b tree) version, instead of hash table
one. Previous commit from wrong tree. Spotted by Andre Lucas <andre
at ae-35 dot com> ok millert@ canacar@


# 1.16 14-Jun-2004 otto

- use fmt_scaled(3) instead of home grown function to print -h numbers
- do not use a linear list to keep track of inodes with link count > 2,
use a red & black tree. Based on freebsd code that uses auto-sizing
hash maps; this tree version by canacar@.

ok millert@ canacar@


# 1.15 02-Jun-2004 tom

Don't want text in err() call following malloc failures.

ok henning@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.14 02-Jul-2003 deraadt

protos


# 1.13 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.12 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.11 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.10 30-Jul-2001 deraadt

fix 0B case; morten@hotpost.dk


# 1.9 12-Jul-2001 deraadt

first pass at a -Wall cleanup


# 1.8 02-May-2001 pjanzen

-h overrides BLOCKSIZE; matt@anzen.com


Revision tags: OPENBSD_2_9_BASE
# 1.7 23-Feb-2001 pjanzen

Add -h option ("human-readable") as df. Based on suggestions and code from
Matt Bing <matt@anzen.com>.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.6 16-Apr-2000 ericj

correct return value; from FreeBSD


Revision tags: OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.5 16-Feb-1998 deraadt

-r for xpg conformance


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 15-Jan-1997 millert

getopt(3) returns -1 when out of args, not EOF, whee!


# 1.3 18-Oct-1996 millert

Implement a -c (Grand Total) option, a'la GNU du(1).
From Luke Mewburn <lukem@telstra.com.au>, NetBSD PR #2805.
Also -Wall happiness.


Revision tags: OPENBSD_2_0_BASE
# 1.2 26-Jun-1996 deraadt

rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision