From d966913f5755577d76ec61c58fdfddf542349125 Mon Sep 17 00:00:00 2001 From: mycroft Date: Tue, 27 Dec 1994 23:14:46 +0000 Subject: [PATCH] Sync with CSRG. --- bin/ls/ls.1 | 15 ++++++++++----- bin/ls/ls.c | 18 +++++++++++++++--- bin/ls/print.c | 7 +++++-- bin/ls/stat_flags.c | 9 +++++++-- bin/ls/util.c | 6 +++--- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index 7f9dba05c39d..a4e1089b7cf2 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. .\" -.\" from: @(#)ls.1 8.6 (Berkeley) 4/18/94 -.\" $Id: ls.1,v 1.9 1994/09/23 06:14:48 mycroft Exp $ +.\" from: @(#)ls.1 8.7 (Berkeley) 7/29/94 +.\" $Id: ls.1,v 1.10 1994/12/27 23:14:46 mycroft 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 ACFLRSTacdfikloqrstu1 +.Op Fl ACFLRSTWacdfikloqrstu1 .Op Ar file ... .Sh DESCRIPTION For each operand that names a @@ -82,7 +82,8 @@ Force multi-column output; this is the default when output is to a terminal. Display a slash (/) immediately after each pathname that is a directory, an asterisk (*) after each that is executable, -and an at sign (@) after each symbolic link. +an at sign (@) after each symbolic link, +and a percent sign (%) after each whiteout. .\" and a vertical bar (|) after each that is a .\" .Tn FIFO . .It Fl L @@ -95,6 +96,8 @@ Sort by size, largest file first. .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. .It Fl a Include directory entries whose names begin with a dot (.). @@ -220,6 +223,8 @@ Symbolic link. Socket link. .\" .It Sy p .\" .Tn FIFO . +.It Sy w +Whiteout. .It Sy \- Regular file. .El diff --git a/bin/ls/ls.c b/bin/ls/ls.c index a8e4d7ec797a..519d4c82b8f4 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -41,8 +41,8 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -/*static char sccsid[] = "from: @(#)ls.c 8.5 (Berkeley) 4/2/94";*/ -static char *rcsid = "$Id: ls.c,v 1.12 1994/09/23 06:14:51 mycroft Exp $"; +/*static char sccsid[] = "from: @(#)ls.c 8.7 (Berkeley) 8/5/94";*/ +static char *rcsid = "$Id: ls.c,v 1.13 1994/12/27 23:14:49 mycroft Exp $"; #endif /* not lint */ #include @@ -98,6 +98,7 @@ int f_size; /* list size in short listing */ int f_statustime; /* use time of last mode change */ int f_dirname; /* if precede with directory name */ int f_type; /* add type character for non-regular files */ +int f_whiteout; /* show whiteout entries */ int main(argc, argv) @@ -128,7 +129,7 @@ main(argc, argv) f_listdot = 1; fts_options = FTS_PHYSICAL; - while ((ch = getopt(argc, argv, "1ACFLRSTacdfgikloqrstu")) != -1) { + while ((ch = getopt(argc, argv, "1ACFLRSTWacdfgikloqrstu")) != -1) { switch (ch) { /* * The -1, -C and -l options all override each other so shell @@ -209,6 +210,9 @@ main(argc, argv) case 't': sortkey = BY_TIME; break; + case 'W': + f_whiteout = 1; + break; default: case '?': usage(); @@ -232,6 +236,14 @@ main(argc, argv) if (!f_longform && !f_listdir && !f_type) fts_options |= FTS_COMFOLLOW; + /* + * If -W, show whiteout entries. + */ +#ifdef FTS_WHITEOUT + if (f_whiteout) + fts_options |= FTS_WHITEOUT; +#endif + /* If -l or -s, figure out block size. */ if (f_longform || f_size) { if (!kflag) diff --git a/bin/ls/print.c b/bin/ls/print.c index 54684c383b53..ad0dd9d92358 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -35,8 +35,8 @@ */ #ifndef lint -/*static char sccsid[] = "from: @(#)print.c 8.4 (Berkeley) 4/17/94";*/ -static char *rcsid = "$Id: print.c,v 1.11 1994/09/23 06:14:55 mycroft Exp $"; +/*static char sccsid[] = "from: @(#)print.c 8.5 (Berkeley) 7/27/94";*/ +static char *rcsid = "$Id: print.c,v 1.12 1994/12/27 23:14:50 mycroft Exp $"; #endif /* not lint */ #include @@ -265,6 +265,9 @@ printtype(mode) case S_IFSOCK: (void)putchar('='); return (1); + case S_IFWHT: + (void)putchar('%'); + return (1); } 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 2700ad1f7903..c543e16ed761 100644 --- a/bin/ls/stat_flags.c +++ b/bin/ls/stat_flags.c @@ -32,8 +32,8 @@ */ #ifndef lint -/*static char sccsid[] = "from: @(#)stat_flags.c 8.1 (Berkeley) 5/31/93";*/ -static char *rcsid = "$Id: stat_flags.c,v 1.2 1994/09/23 06:14:57 mycroft Exp $"; +/*static char sccsid[] = "from: @(#)stat_flags.c 8.2 (Berkeley) 7/27/94";*/ +static char *rcsid = "$Id: stat_flags.c,v 1.3 1994/12/27 23:14:52 mycroft Exp $"; #endif /* not lint */ #include @@ -70,6 +70,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) @@ -127,6 +129,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 ba2a6c493328..c32d11dc685b 100644 --- a/bin/ls/util.c +++ b/bin/ls/util.c @@ -35,8 +35,8 @@ */ #ifndef lint -/*static char sccsid[] = "from: @(#)util.c 8.3 (Berkeley) 4/2/94";*/ -static char *rcsid = "$Id: util.c,v 1.9 1994/10/25 02:29:46 mycroft Exp $"; +/*static char sccsid[] = "from: @(#)util.c 8.4 (Berkeley) 7/27/94";*/ +static char *rcsid = "$Id: util.c,v 1.10 1994/12/27 23:14:54 mycroft Exp $"; #endif /* not lint */ #include @@ -68,6 +68,6 @@ void usage() { - (void)fprintf(stderr, "usage: ls [-1ACFLRSTacdfikloqrstu] [file ...]\n"); + (void)fprintf(stderr, "usage: ls [-1ACFLRSTWacdfikloqrstu] [file ...]\n"); exit(1); }