commit 98eff6256267475fae5b82e2d62bce14bf55ea2d
Author: sin <[email protected]>
Date:   Tue Feb 17 16:07:10 2015 +0000

    du: Update usage and document -P as well

diff --git a/du.1 b/du.1
index 8eee211..8a77983 100644
--- a/du.1
+++ b/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
diff --git a/du.c b/du.c
index 917d2bb..a71a6f9 100644
--- a/du.c
+++ b/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));
                }

Reply via email to