summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-01-18 18:01:51 +0000
committerJim Meyering <jim@meyering.net>2003-01-18 18:01:51 +0000
commitba2b351bbf58cbc6ae9ccc880623ffce16f65c05 (patch)
tree045d6642a59f04373bc97b935054fb26d5a5cbf9 /src/ls.c
parentf0110096ac8501a66285390f97437ca5b20b0193 (diff)
downloadcoreutils-ba2b351bbf58cbc6ae9ccc880623ffce16f65c05.tar.xz
Change ls -H back to the way it was yesterday, since this is
compatible with FreeBSD and the POSIX spec is confusing and somewhat contradictory. (DEREF_COMMAND_LINE_ARGUMENTS): Change name back from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses. (long_options): Change the long option name back. (usage): Change the usage back. (gobble_file): When -H is specified, dereference a top-level arg even if it points to a non-directory.
Diffstat (limited to 'src/ls.c')
-rw-r--r--src/ls.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/ls.c b/src/ls.c
index e15d5cfa9..de49ec7a3 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -518,7 +518,7 @@ enum Dereference_symlink
{
DEREF_UNDEFINED = 1,
DEREF_NEVER,
- DEREF_COMMAND_LINE_SYMLINK_TO_DIR, /* -H */
+ DEREF_COMMAND_LINE_ARGUMENTS, /* -H */
DEREF_ALWAYS /* -L */
};
@@ -722,7 +722,7 @@ static struct option const long_options[] =
{"classify", no_argument, 0, 'F'},
{"file-type", no_argument, 0, 'p'},
{"si", no_argument, 0, SI_OPTION},
- {"dereference-command-line-symlink-to-dir", no_argument, 0, 'H'},
+ {"dereference-command-line", no_argument, 0, 'H'},
{"ignore", required_argument, 0, 'I'},
{"indicator-style", required_argument, 0, INDICATOR_STYLE_OPTION},
{"dereference", no_argument, 0, 'L'},
@@ -1100,7 +1100,7 @@ main (int argc, char **argv)
|| indicator_style == classify
|| format == long_format)
? DEREF_NEVER
- : DEREF_COMMAND_LINE_SYMLINK_TO_DIR);
+ : DEREF_COMMAND_LINE_ARGUMENTS);
/* When using -R, initialize a data structure we'll use to
detect any directory cycles. */
@@ -1513,7 +1513,7 @@ decode_switches (int argc, char **argv)
break;
case 'H':
- dereference = DEREF_COMMAND_LINE_SYMLINK_TO_DIR;
+ dereference = DEREF_COMMAND_LINE_ARGUMENTS;
break;
case 'I':
@@ -2353,21 +2353,16 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
err = stat (path, &files[files_index].stat);
break;
- case DEREF_COMMAND_LINE_SYMLINK_TO_DIR:
+ case DEREF_COMMAND_LINE_ARGUMENTS:
if (explicit_arg)
{
- int need_lstat;
err = stat (path, &files[files_index].stat);
- /* If stat failed because of ENOENT (maybe indicating a
- dangling symlink), or if it succeeded and PATH refers
- to a non-directory (hence PATH may be a symlink to a
- non-directory and we may not dereference it), fall
- through so that we call lstat instead. */
- need_lstat = (err < 0
- ? errno == ENOENT
- : ! S_ISDIR (files[files_index].stat.st_mode));
- if (!need_lstat)
+ if (! (err < 0 && errno == ENOENT))
break;
+
+ /* stat failed because of ENOENT, maybe indicating a
+ dangling symlink. Fall through so that we call lstat
+ instead. */
}
/* fall through. */
@@ -3768,9 +3763,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
-G, --no-group inhibit display of group information\n\
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\
--si likewise, but use powers of 1000 not 1024\n\
- -H, --dereference-command-line-symlink-to-dir\n\
- follow each command line symbolic link\n\
- that points to a directory\n\
+ -H, --dereference-command-line follow symbolic links on the command line\n\
"), stdout);
fputs (_("\
--indicator-style=WORD append indicator with style WORD to entry names:\n\