1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00

add support for the (POSIX) -H flag

feedback and ok millert@, sobrado@, jmc@
This commit is contained in:
okan 2011-03-04 21:03:19 +00:00
parent 607a4d95ef
commit 9079317df9
3 changed files with 17 additions and 7 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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);
}