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
|
.Dt DU 1
|
||||||
.Os sbase
|
.Os sbase
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -8,10 +8,9 @@
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl a | s
|
.Op Fl a | s
|
||||||
.Op Fl d Ar depth
|
.Op Fl d Ar depth
|
||||||
.Op Fl H
|
|
||||||
.Op Fl L
|
|
||||||
.Op Fl h
|
.Op Fl h
|
||||||
.Op Fl k
|
.Op Fl k
|
||||||
|
.Op Fl H | L | P
|
||||||
.Op Ar file ...
|
.Op Ar file ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -26,13 +25,10 @@ is displayed.
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl a
|
.It Fl a
|
||||||
Display an entry for each file in the file hierarchy.
|
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
|
.It Fl d Ar depth
|
||||||
Maximum directory depth to print files and directories.
|
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
|
.It Fl h
|
||||||
Enable human-readable output.
|
Enable human-readable output.
|
||||||
.It Fl k
|
.It Fl k
|
||||||
|
@ -40,6 +36,11 @@ By default all sizes are reported in 512-byte block counts.
|
||||||
The
|
The
|
||||||
.Fl k
|
.Fl k
|
||||||
option causes the numbers to be reported in kilobyte counts.
|
option causes the numbers to be reported in kilobyte counts.
|
||||||
.It Fl s
|
.It Fl H
|
||||||
Display only the grand total for the specified files.
|
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
|
.El
|
||||||
|
|
11
du.c
11
du.c
|
@ -21,7 +21,7 @@ static int dflag = 0;
|
||||||
static int sflag = 0;
|
static int sflag = 0;
|
||||||
static int kflag = 0;
|
static int kflag = 0;
|
||||||
static int hflag = 0;
|
static int hflag = 0;
|
||||||
static int HLflag = 'P';
|
static int HLPflag = 'P';
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
xrealpath(const char *pathname, char *resolved)
|
xrealpath(const char *pathname, char *resolved)
|
||||||
|
@ -138,7 +138,7 @@ done:
|
||||||
static void
|
static void
|
||||||
usage(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
|
int
|
||||||
|
@ -166,7 +166,8 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
case 'L':
|
case 'L':
|
||||||
HLflag = ARGC();
|
case 'P':
|
||||||
|
HLPflag = ARGC();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
@ -183,13 +184,13 @@ main(int argc, char *argv[])
|
||||||
blksize = 1024;
|
blksize = 1024;
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
n = du(".", HLflag);
|
n = du(".", HLPflag);
|
||||||
if (sflag)
|
if (sflag)
|
||||||
print(n, xrealpath(".", file));
|
print(n, xrealpath(".", file));
|
||||||
} else {
|
} else {
|
||||||
for (; argc > 0; argc--, argv++) {
|
for (; argc > 0; argc--, argv++) {
|
||||||
curdepth = 0;
|
curdepth = 0;
|
||||||
n = du(argv[0], HLflag);
|
n = du(argv[0], HLPflag);
|
||||||
if (sflag)
|
if (sflag)
|
||||||
print(n, xrealpath(argv[0], file));
|
print(n, xrealpath(argv[0], file));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user