du: Update usage and document -P as well
This commit is contained in:
parent
e5b5497773
commit
6c31f1d2a8
21
du.1
21
du.1
@ -1,4 +1,4 @@
|
||||
.Dd January 30, 2015
|
||||
.Dd February 17, 2015
|
||||
.Dt DU 1
|
||||
.Os sbase
|
||||
.Sh NAME
|
||||
@ -8,10 +8,9 @@
|
||||
.Nm
|
||||
.Op Fl a | s
|
||||
.Op Fl d Ar depth
|
||||
.Op Fl H
|
||||
.Op Fl L
|
||||
.Op Fl h
|
||||
.Op Fl k
|
||||
.Op Fl H | L | P
|
||||
.Op Ar file ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
@ -26,13 +25,10 @@ is displayed.
|
||||
.Bl -tag -width Ds
|
||||
.It Fl a
|
||||
Display an entry for each file in the file hierarchy.
|
||||
.It Fl s
|
||||
Display only the grand total for the specified files.
|
||||
.It Fl d Ar depth
|
||||
Maximum directory depth to print files and directories.
|
||||
.It Fl H
|
||||
Only dereference symbolic links that are passed as command line arguments when
|
||||
recursively traversing directories.
|
||||
.It Fl L
|
||||
Always dereference symbolic links while recursively traversing directories.
|
||||
.It Fl h
|
||||
Enable human-readable output.
|
||||
.It Fl k
|
||||
@ -40,6 +36,11 @@ By default all sizes are reported in 512-byte block counts.
|
||||
The
|
||||
.Fl k
|
||||
option causes the numbers to be reported in kilobyte counts.
|
||||
.It Fl s
|
||||
Display only the grand total for the specified files.
|
||||
.It Fl H
|
||||
Only dereference symbolic links that are passed as command line arguments when
|
||||
recursively traversing directories.
|
||||
.It Fl L
|
||||
Always dereference symbolic links while recursively traversing directories.
|
||||
.It FL P
|
||||
Don't dereference symbolic links. This is the default.
|
||||
.El
|
||||
|
11
du.c
11
du.c
@ -21,7 +21,7 @@ static int dflag = 0;
|
||||
static int sflag = 0;
|
||||
static int kflag = 0;
|
||||
static int hflag = 0;
|
||||
static int HLflag = 'P';
|
||||
static int HLPflag = 'P';
|
||||
|
||||
static char *
|
||||
xrealpath(const char *pathname, char *resolved)
|
||||
@ -138,7 +138,7 @@ done:
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s [-a | -s] [-d depth] [-h] [-k] [file ...]\n", argv0);
|
||||
eprintf("usage: %s [-a | -s] [-d depth] [-h] [-k] [-H | -L | -P] [file ...]\n", argv0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -166,7 +166,8 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 'H':
|
||||
case 'L':
|
||||
HLflag = ARGC();
|
||||
case 'P':
|
||||
HLPflag = ARGC();
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
@ -183,13 +184,13 @@ main(int argc, char *argv[])
|
||||
blksize = 1024;
|
||||
|
||||
if (argc < 1) {
|
||||
n = du(".", HLflag);
|
||||
n = du(".", HLPflag);
|
||||
if (sflag)
|
||||
print(n, xrealpath(".", file));
|
||||
} else {
|
||||
for (; argc > 0; argc--, argv++) {
|
||||
curdepth = 0;
|
||||
n = du(argv[0], HLflag);
|
||||
n = du(argv[0], HLPflag);
|
||||
if (sflag)
|
||||
print(n, xrealpath(argv[0], file));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user