diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2011-03-04 21:03:20 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2011-03-04 21:03:20 +0000 |
commit | f32c6cef51160ef4721d153ed090d42a52faba68 (patch) | |
tree | bc8f9ad76d6a2223f58e07904ee568296ffb7739 /bin/ls | |
parent | e2f8e6d5d50c4fd4c3b7be00097da0c7ed49a64f (diff) |
add support for the (POSIX) -H flag
feedback and ok millert@, sobrado@, jmc@
Diffstat (limited to 'bin/ls')
-rw-r--r-- | bin/ls/ls.1 | 13 | ||||
-rw-r--r-- | bin/ls/ls.c | 7 | ||||
-rw-r--r-- | bin/ls/util.c | 4 |
3 files changed, 17 insertions, 7 deletions
diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index 9cf23379b60..2eaa07e71bb 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ls.1,v 1.62 2010/09/03 09:53:20 jmc Exp $ +.\" $OpenBSD: ls.1,v 1.63 2011/03/04 21:03:19 okan Exp $ .\" $NetBSD: ls.1,v 1.14 1995/12/05 02:44:01 jtc Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993, 1994 @@ -33,7 +33,7 @@ .\" .\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" -.Dd $Mdocdate: September 3 2010 $ +.Dd $Mdocdate: March 4 2011 $ .Dt LS 1 .Os .Sh NAME @@ -41,7 +41,7 @@ .Nd list directory contents .Sh SYNOPSIS .Nm ls -.Op Fl 1AaCcdFfghikLlmnopqRrSsTtux +.Op Fl 1AaCcdFfgHhikLlmnopqRrSsTtux .Op Ar .Sh DESCRIPTION For each operand that names a @@ -125,6 +125,13 @@ Output is not sorted. List in long format as in .Fl l , except that the owner is not printed. +.It Fl H +Follow symbolic links specified on the command line. +This is also the default behaviour when none of the +.Fl d , F , +or +.Fl l +options are specified. .It Fl h When used with a long format option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 7130eae1534..bbdae89ac19 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.36 2010/09/12 20:16:29 sobrado Exp $ */ +/* $OpenBSD: ls.c,v 1.37 2011/03/04 21:03:19 okan Exp $ */ /* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */ /* @@ -122,7 +122,7 @@ ls_main(int argc, char *argv[]) f_listdot = 1; fts_options = FTS_PHYSICAL; - while ((ch = getopt(argc, argv, "1ACFLRSTacdfghiklmnopqrstux")) != -1) { + while ((ch = getopt(argc, argv, "1ACFHLRSTacdfghiklmnopqrstux")) != -1) { switch (ch) { /* * The -1, -C and -l, -m, -n and -x options all override each @@ -176,6 +176,9 @@ ls_main(int argc, char *argv[]) case 'F': f_type = 1; break; + case 'H': + fts_options |= FTS_COMFOLLOW; + break; case 'L': fts_options &= ~FTS_PHYSICAL; fts_options |= FTS_LOGICAL; diff --git a/bin/ls/util.c b/bin/ls/util.c index 22f97ccb5e6..869a6b3ec2e 100644 --- a/bin/ls/util.c +++ b/bin/ls/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.14 2009/10/27 23:59:21 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.15 2011/03/04 21:03:19 okan Exp $ */ /* $NetBSD: util.c,v 1.12 1995/09/07 06:43:02 jtc Exp $ */ /* @@ -59,7 +59,7 @@ void usage(void) { (void)fprintf(stderr, - "usage: %s [-1AaCcdFfghikLlmnopqRrSsTtux] [file ...]\n", + "usage: %s [-1AaCcdFfgHhikLlmnopqRrSsTtux] [file ...]\n", __progname); exit(1); } |