bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls -F indicators


From: Paul Eggert
Subject: Re: ls -F indicators
Date: Mon, 02 May 2005 11:48:58 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Eric Blake <address@hidden> writes:

> I take it whiteouts are another form of special file, unique to FreeBSD?

They're in other BSD flavors too.  They're used in union mounts, so
that you can remove a file at the top level of the union, and that the
file appears to be gone even if the underyling mounts have it.  See
Pendry & McKusick, Union Mounts in 4.4BSD-Lite
<http://www.usenix.org/publications/library/proceedings/neworl/full_papers/mckusick.ps>.

> What about proposing '^' (with the mnemonic pronounciation caret) as the
> character-special indicator, to the bash mailing list?

That would be an improvement, yes.  (You can also use the argument
that "^" looks a bit like a "c" rotated 90 degrees.  :-)

> And can coreutils detect whiteouts on FreeBSD systems,

Yes, if someone contributes that code.  There are some other FreeBSD
things that need porting, too, though.  For example, support for
nanosecond-resolution time stamps.  If someone wants to follow up on
this I suggest they contact the GNU/kFreeBSD folks:

http://www.debian.org/ports/kfreebsd-gnu/
http://www.haible.de/bruno/gnu-freebsd/


> I noticed that the comments in lib/filemode.c list a few filetypes
> for the first character of `ls -l' that are not mentioned in the
> info pages, such as 'n' for network special file.  Do any of the
> other recognized file types deserve their own indicator flag?

I don't ee a great need, but I suppose others might.


> Previously, `ls --classify' was short for `ls --indicator-style=classify',
> and `ls --file-type' was short for `ls --indicator-style=file-type'.  But
> `ls --directory' already exists; is there a better choice of indicator
> names to allow parallelism for a shorter spelling of `ls
> --indicator-style=directory'?  Perhaps `ls --mark-directory'?

Thanks for pointing that out.  "--mark-directory" is also a bit
strange, I guess, since people who are confused by "--directory" will
also be confused by that.  We're talking about a rarely used option
here so I don't think it's that important to name it (other than
avoiding confusion with other options).  How about
--indicator-style='slash'?  I installed this:

2005-05-02  Paul Eggert  <address@hidden>

        * NEWS: ls --indicator-style=directory renamed to ls
        --indicator-style=slash, to avoid confusion with ls --directory.
        * doc/coreutils.texi (ls invocation): ls --indicator-style=directory
        renamed to ls --indicator-style=slash, to avoid confusion with ls
        --directory.
        * src/ls.c (usage): Likewise.
        (slash): Renamed from directory_only.  All uses changed.

Index: NEWS
===================================================================
RCS file: /fetish/cu/NEWS,v
retrieving revision 1.283
diff -p -u -r1.283 NEWS
--- NEWS        1 May 2005 14:33:23 -0000       1.283
+++ NEWS        2 May 2005 18:32:37 -0000
@@ -65,7 +65,7 @@ GNU coreutils NEWS                      
   ls changes:
 
     -p now marks only directories; it is equivalent to the new option
-    --indicator-style=directory.  Use --file-type or
+    --indicator-style=slash.  Use --file-type or
     --indicator-style=file-type to get -p's old behavior.
 
   nohup changes:
Index: doc/coreutils.texi
===================================================================
RCS file: /fetish/cu/doc/coreutils.texi,v
retrieving revision 1.253
diff -p -u -r1.253 coreutils.texi
--- doc/coreutils.texi  29 Apr 2005 21:00:01 -0000      1.253
+++ doc/coreutils.texi  2 May 2005 18:32:43 -0000
@@ -5903,7 +5903,7 @@ as follows:
 @table @samp
 @item none
 Do not append any character indicator; this is the default.
address@hidden directory
address@hidden slash
 Append @samp{/} for directories.  This is the same as the @option{-p}
 option.
 @item file-type
@@ -5931,7 +5931,7 @@ List files horizontally, with as many as
 separated by @samp{, } (a comma and a space).
 
 @item -p
address@hidden --indicator-style=directory
address@hidden --indicator-style=slash
 @opindex -p
 @opindex --indicator-style
 @cindex file type, marking
Index: src/ls.c
===================================================================
RCS file: /fetish/cu/src/ls.c,v
retrieving revision 1.383
diff -p -u -r1.383 ls.c
--- src/ls.c    29 Apr 2005 21:01:04 -0000      1.383
+++ src/ls.c    2 May 2005 18:32:45 -0000
@@ -463,7 +463,7 @@ static uintmax_t file_output_block_size 
 static bool dired;
 
 /* `none' means don't mention the type of files.
-   `directory' means mention directories.
+   `slash' means mention directories only, with a '/'.
    `file_type' means mention file types.
    `classify' means mention file types and mark executables.
 
@@ -471,10 +471,10 @@ static bool dired;
 
 enum indicator_style
   {
-    none,              /*     --indicator-style=none */
-    directory_only,    /* -p, --indicator-style=directory */
-    file_type,         /*     --indicator-style=file-type */
-    classify           /* -F, --indicator-style=classify */
+    none,      /*     --indicator-style=none */
+    slash,     /* -p, --indicator-style=slash */
+    file_type, /*     --indicator-style=file-type */
+    classify   /* -F, --indicator-style=classify */
   };
 
 static enum indicator_style indicator_style;
@@ -482,12 +482,12 @@ static enum indicator_style indicator_st
 /* Names of indicator styles.  */
 static char const *const indicator_style_args[] =
 {
-  "none", "directory", "file-type", "classify", NULL
+  "none", "slash", "file-type", "classify", NULL
 };
 
 static enum indicator_style const indicator_style_types[] =
 {
-  none, directory_only, file_type, classify
+  none, slash, file_type, classify
 };
 
 /* True means use colors to mark types.  Also define the different
@@ -1547,7 +1547,7 @@ decode_switches (int argc, char **argv)
          break;
 
        case 'p':
-         indicator_style = directory_only;
+         indicator_style = slash;
          break;
 
        case 'q':
@@ -3641,7 +3641,7 @@ print_type_indicator (mode_t mode)
     {
       if (S_ISDIR (mode))
        c = '/';
-      else if (indicator_style == directory_only)
+      else if (indicator_style == slash)
        c = 0;
       else if (S_ISLNK (mode))
        c = '@';
@@ -3759,7 +3759,7 @@ length_of_file_name_and_frills (const st
       len += (S_ISREG (mode)
              ? (indicator_style == classify && (mode & S_IXUGO))
              : (S_ISDIR (mode)
-                || (indicator_style != directory_only
+                || (indicator_style != slash
                     && (S_ISLNK (mode)
                         || S_ISFIFO (mode)
                         || S_ISSOCK (mode)
@@ -4105,7 +4105,7 @@ Mandatory arguments to long options are 
 "), stdout);
       fputs (_("\
       --indicator-style=WORD append indicator with style WORD to entry 
names:\n\
-                               none (default), directory (-p),\n\
+                               none (default), slash (-p),\n\
                                file-type (--file-type), classify (-F)\n\
   -i, --inode                with -l, print the index number of each file\n\
   -I, --ignore=PATTERN       do not list implied entries matching shell 
PATTERN\n\
@@ -4123,7 +4123,7 @@ Mandatory arguments to long options are 
   -N, --literal              print raw entry names (don't treat e.g. control\n\
                                characters specially)\n\
   -o                         like -l, but do not list group information\n\
-  -p, --indicator-style=directory\n\
+  -p, --indicator-style=slash\n\
                              append / indicator to directories\n\
 "), stdout);
       fputs (_("\




reply via email to

[Prev in Thread] Current Thread [Next in Thread]