Module Name: othersrc Committed By: ginsbach Date: Wed Aug 30 19:18:31 UTC 2017
Modified Files: othersrc/external/bsd/dust/dist: dust.1 dust.sh Log Message: Add a way to pass -a and -x to du(1). These allow one to 'dust' a filesystem (-x) or see what files are the big offenders (-a) rather than just the big directories (default). To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/dust/dist/dust.1 \ othersrc/external/bsd/dust/dist/dust.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/external/bsd/dust/dist/dust.1 diff -u othersrc/external/bsd/dust/dist/dust.1:1.2 othersrc/external/bsd/dust/dist/dust.1:1.3 --- othersrc/external/bsd/dust/dist/dust.1:1.2 Wed Apr 2 08:50:43 2014 +++ othersrc/external/bsd/dust/dist/dust.1 Wed Aug 30 19:18:31 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: dust.1,v 1.2 2014/04/02 08:50:43 wiz Exp $ +.\" $NetBSD: dust.1,v 1.3 2017/08/30 19:18:31 ginsbach Exp $ .\" .\" Copyright (c) 2014 Alistair Crooks <a...@netbsd.org> .\" All rights reserved. @@ -31,8 +31,9 @@ .Nd print directory listings ordered by size .Sh SYNOPSIS .Nm -.Op Fl rs -.Ar file ... +.Op Fl rx +.Op Fl a | Fl s +.Op Ar file ... .Sh DESCRIPTION The .Nm @@ -42,15 +43,19 @@ to retrieve the sizes on disk of the specified files and directories, and orders them in size order. .Bl -tag -width XrX +.It Fl a +Display an entry for each file in the directory hierarchy. .It Fl r Reverse the order of the output \(em instead of printing -the directory entries in smallest to largest order, +the directory or file entries in smallest to largest order, this argument will print the entries in largest to smallest order. .It Fl s As in .Xr du 1 , perform the listing silently, recursing into directories, but only printing the results at the topmost level of specification. +.It Fl x +Filesystem mounts points are not traversed. .Sh EXIT STATUS .Ex -std dust .Sh EXAMPLES Index: othersrc/external/bsd/dust/dist/dust.sh diff -u othersrc/external/bsd/dust/dist/dust.sh:1.2 othersrc/external/bsd/dust/dist/dust.sh:1.3 --- othersrc/external/bsd/dust/dist/dust.sh:1.2 Wed Aug 30 18:49:31 2017 +++ othersrc/external/bsd/dust/dist/dust.sh Wed Aug 30 19:18:31 2017 @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: dust.sh,v 1.2 2017/08/30 18:49:31 ginsbach Exp $ +# $NetBSD: dust.sh,v 1.3 2017/08/30 19:18:31 ginsbach Exp $ # Copyright (c) 2013 Alistair Crooks <a...@netbsd.org> # All rights reserved. @@ -26,26 +26,38 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -# Usage: dust [-r] [-s] file... +# Usage: dust [-rx] [-a | -s] file... +# -a == list all files, don't summarize by directory # -r == reverse sort, largest first, smallest last # -s == silent execution of du, don't recurse into subdirs +# -x == file system mount points are not traversed +all="" +exclude="" revsort="" silent="" -while getopts "rs" arg; do +while getopts "arsx" arg; do case "$arg" in + a) all="-a" ;; r) revsort="-r" ;; s) silent="-s" ;; - *) echo "Usage: $(basename $0) [-r] [-s] [file ...]"; exit 1 ;; + x) exclude="-x" ;; + *) echo "Usage: $(basename $0) [-rx] [-a | -s] [file ...]" 2>&1 + exit 1 ;; esac done shift $(expr $OPTIND - 1) +if [ -n "${all}" ] && [ -n "${silent}" ]; then + echo "Usage: $(basename $0) [-rx] [-a | -s] [file ...]" 2>&1 + exit 1 +fi + awk=/usr/bin/awk du=/usr/bin/du sort=/usr/bin/sort -${du} -h ${silent} "$@" | ${awk} ' +${du} -h ${all} ${exclude} ${silent} "$@" | ${awk} ' BEGIN { n = 1; sufs = "BKMGT"; for (i = 1 ; i <= length(sufs) ; i++) {