summaryrefslogtreecommitdiffstats
path: root/bin/ls
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1996-12-14 06:03:29 +0000
committersteve <steve@FreeBSD.org>1996-12-14 06:03:29 +0000
commit69ca26a30523449bee72a8ea347bfcc2b42d077c (patch)
tree163f19c661895d601b0a50b8c43ae2b7724325db /bin/ls
parentbf89557b965b65cdaf9e19c5c46ee200420c354e (diff)
downloadFreeBSD-src-69ca26a30523449bee72a8ea347bfcc2b42d077c.zip
FreeBSD-src-69ca26a30523449bee72a8ea347bfcc2b42d077c.tar.gz
Merge Lite2 mods, and -Wall cleaning. undelete(2) cruft
not yet implemented is protected by a define (BSD4_4_LITE) that should be removed when this call is supported by the kernel.
Diffstat (limited to 'bin/ls')
-rw-r--r--bin/ls/cmp.c4
-rw-r--r--bin/ls/ls.113
-rw-r--r--bin/ls/ls.c28
-rw-r--r--bin/ls/ls.h7
-rw-r--r--bin/ls/print.c13
-rw-r--r--bin/ls/stat_flags.c9
-rw-r--r--bin/ls/util.c8
7 files changed, 63 insertions, 19 deletions
diff --git a/bin/ls/cmp.c b/bin/ls/cmp.c
index 51397b4..db72a1d 100644
--- a/bin/ls/cmp.c
+++ b/bin/ls/cmp.c
@@ -33,11 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: cmp.c,v 1.2 1994/09/24 02:55:52 davidg Exp $
*/
#ifndef lint
-static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 5/31/93";
+static char const sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 5/31/93";
#endif /* not lint */
#include <sys/types.h>
diff --git a/bin/ls/ls.1 b/bin/ls/ls.1
index 077b9a0..2ad38fd 100644
--- a/bin/ls/ls.1
+++ b/bin/ls/ls.1
@@ -32,10 +32,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ls.1 8.6 (Berkeley) 4/18/94
-.\" $Id: ls.1,v 1.4 1995/09/26 08:48:09 mpp Exp $
+.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
+.\" $Id: ls.1,v 1.5 1996/08/29 18:05:56 wosch Exp $
.\"
-.Dd April 18, 1994
+.Dd July 29, 1994
.Dt LS 1
.Os
.Sh NAME
@@ -43,7 +43,7 @@
.Nd list directory contents
.Sh SYNOPSIS
.Nm ls
-.Op Fl ACFLRTacdfiloqrstu1
+.Op Fl ACFLRTWacdfiloqrstu1
.Op Ar file ...
.Sh DESCRIPTION
For each operand that names a
@@ -84,8 +84,9 @@ that is a directory, an asterisk (*) after each that is
executable,
an at sign (@) after each symbolic link,
an equals sign (=) after each socket,
+a percent sign (%) after each whiteout,
and a vertical bar (|) after each that is a
-.Tn FIFO .
+.Tn FIFO .
.It Fl L
If argument is a symbolic link, list the file or directory the link references
rather than the link itself.
@@ -94,6 +95,8 @@ Recursively list subdirectories encountered.
.It Fl T
Display complete time information for the file, including
month, day, hour, minute, second, and year.
+.It Fl W
+Display whiteouts when scanning directories. (UNIMPLEMENTED)
.It Fl a
Include directory entries whose names begin with a
dot (.).
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index fb747de..4d39324 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -33,17 +33,17 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ls.c,v 1.9 1995/10/26 10:56:38 ache Exp $
+ * $Id: ls.c,v 1.10 1996/08/27 21:51:48 adam Exp $
*/
#ifndef lint
-static char copyright[] =
+static char const copyright[] =
"@(#) Copyright (c) 1989, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ls.c 8.5 (Berkeley) 4/2/94";
+static char const sccsid[] = "@(#)ls.c 8.5 (Berkeley) 4/2/94";
#endif /* not lint */
#include <sys/types.h>
@@ -94,6 +94,9 @@ int f_statustime; /* use time of last mode change */
int f_dirname; /* if precede with directory name */
int f_timesort; /* sort by time vice name */
int f_type; /* add type character for non-regular files */
+#ifndef BSD4_4_LITE
+int f_whiteout; /* show whiteout entries */
+#endif
int rval;
@@ -131,7 +134,11 @@ main(argc, argv)
f_listdot = 1;
fts_options = FTS_PHYSICAL;
+#ifdef BSD4_4_LITE
while ((ch = getopt(argc, argv, "1ACFLRTacdfgikloqrstu")) != EOF) {
+#else
+ while ((ch = getopt(argc, argv, "1ACFLRTWacdfgikloqrstu")) != EOF) {
+#endif
switch (ch) {
/*
* The -1, -C and -l options all override each other so shell
@@ -208,6 +215,11 @@ main(argc, argv)
case 't':
f_timesort = 1;
break;
+#ifndef BSD4_4_LITE
+ case 'W':
+ f_whiteout = 1;
+ break;
+#endif
default:
case '?':
usage();
@@ -230,6 +242,16 @@ main(argc, argv)
if (!f_longform && !f_listdir && !f_type)
fts_options |= FTS_COMFOLLOW;
+#ifndef BSD4_4_LITE
+ /*
+ * If -W, show whiteout entries
+ */
+#ifdef FTS_WHITEOUT
+ if (f_whiteout)
+ fts_options |= FTS_WHITEOUT;
+#endif
+#endif
+
/* If -l or -s, figure out block size. */
if (f_longform || f_size) {
if (f_kblocks)
diff --git a/bin/ls/ls.h b/bin/ls/ls.h
index 61c319e..dd95413 100644
--- a/bin/ls/ls.h
+++ b/bin/ls/ls.h
@@ -34,10 +34,15 @@
* SUCH DAMAGE.
*
* @(#)ls.h 8.1 (Berkeley) 5/31/93
- * $Id$
+ * $Id: ls.h,v 1.2 1994/09/24 02:55:55 davidg Exp $
*/
#define NO_PRINT 1
+/*
+ * XXX Until we get kernel support for the undelete(2) system call,
+ * this define *must* remain in place.
+ */
+#define BSD4_4_LITE
extern long blocksize; /* block size units */
diff --git a/bin/ls/print.c b/bin/ls/print.c
index 5f96695..e7b63f0 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -33,11 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: print.c,v 1.7 1995/12/30 18:15:30 joerg Exp $
+ * $Id: print.c,v 1.8 1996/01/20 10:31:14 mpp Exp $
*/
#ifndef lint
-static char sccsid[] = "@(#)print.c 8.4 (Berkeley) 4/17/94";
+static char const sccsid[] = "@(#)print.c 8.4 (Berkeley) 4/17/94";
#endif /* not lint */
#include <sys/param.h>
@@ -95,7 +95,7 @@ printlong(dp)
continue;
sp = p->fts_statp;
if (f_inode)
- (void)printf("%*lu ", dp->s_inode, sp->st_ino);
+ (void)printf("%*lu ", dp->s_inode, (u_long)sp->st_ino);
if (f_size)
(void)printf("%*qd ",
dp->s_block, howmany(sp->st_blocks, blocksize));
@@ -215,7 +215,7 @@ printaname(p, inodefield, sizefield)
sp = p->fts_statp;
chcnt = 0;
if (f_inode)
- chcnt += printf("%*lu ", (int)inodefield, sp->st_ino);
+ chcnt += printf("%*lu ", (int)inodefield, (u_long)sp->st_ino);
if (f_size)
chcnt += printf("%*qd ",
(int)sizefield, howmany(sp->st_blocks, blocksize));
@@ -268,6 +268,11 @@ printtype(mode)
case S_IFSOCK:
(void)putchar('=');
return (1);
+#ifndef BSD4_4_LITE
+ case S_IFWHT:
+ (void)putchar('%');
+ return (1);
+#endif
}
if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
(void)putchar('*');
diff --git a/bin/ls/stat_flags.c b/bin/ls/stat_flags.c
index d62a0fd..7e4309c 100644
--- a/bin/ls/stat_flags.c
+++ b/bin/ls/stat_flags.c
@@ -30,11 +30,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: stat_flags.c,v 1.2 1994/09/24 02:55:57 davidg Exp $
*/
#ifndef lint
-static char sccsid[] = "@(#)stat_flags.c 8.1 (Berkeley) 5/31/93";
+static char const sccsid[] = "@(#)stat_flags.c 8.1 (Berkeley) 5/31/93";
#endif /* not lint */
#include <sys/types.h>
@@ -71,6 +71,8 @@ flags_to_string(flags, def)
SAPPEND("uchg");
if (flags & UF_NODUMP)
SAPPEND("nodump");
+ if (flags & UF_OPAQUE)
+ SAPPEND("opaque");
if (flags & SF_APPEND)
SAPPEND("sappnd");
if (flags & SF_ARCHIVED)
@@ -128,6 +130,9 @@ string_to_flags(stringp, setp, clrp)
clear = !clear;
TEST(p, "dump", UF_NODUMP);
return (1);
+ case 'o':
+ TEST(p, "opaque", UF_OPAQUE);
+ return (1);
case 's':
TEST(p, "sappnd", SF_APPEND);
TEST(p, "sappend", SF_APPEND);
diff --git a/bin/ls/util.c b/bin/ls/util.c
index d16ab6a..d452a4b 100644
--- a/bin/ls/util.c
+++ b/bin/ls/util.c
@@ -33,11 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: util.c,v 1.4 1994/10/09 15:25:23 ache Exp $
+ * $Id: util.c,v 1.5 1996/03/31 16:14:11 ache Exp $
*/
#ifndef lint
-static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/2/94";
+static char const sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/2/94";
#endif /* not lint */
#include <sys/types.h>
@@ -68,6 +68,10 @@ prcopy(src, dest, len)
void
usage()
{
+#ifdef BSD4_4_LITE
(void)fprintf(stderr, "usage: ls [-1ACFLRTacdfiklqrstu] [file ...]\n");
+#else
+ (void)fprintf(stderr, "usage: ls [-1ACFLRTWacdfiklqrstu] [file ...]\n");
+#endif
exit(1);
}
OpenPOWER on IntegriCloud