Jim Meyering [Wed, 22 Jan 2003 13:13:04 +0000 (13:13 +0000)]
Include autoconf-recommended block of dirent/NAMELEN
related definitions and includes. Use NAMELEN throughout,
rather than _D_EXACT_NAMLEN.
[_LIBC]: Define NAMELEN to _D_EXACT_NAMLEN.
(stpcpy): Declare, if necessary.
(mempcpy): Define, if necessary.
[!_LIBC] (__stpcpy, __mempcpy): Define.
[!_LIBC] (LXSTAT, XSTAT): Define.
Jim Meyering [Tue, 21 Jan 2003 18:49:49 +0000 (18:49 +0000)]
(remove_entry) [ROOT_CAN_UNLINK_DIRS && HAVE_STRUCT_DIRENT_D_TYPE]: If a file
has d_type == DT_UNKNOWN it may still be a directory -- or not (e.g., with
FreeBSD on an NFS-mounted file system), so resort to calling lstat to find out.
Jim Meyering [Tue, 21 Jan 2003 12:36:56 +0000 (12:36 +0000)]
Don't assume that the file owner username
length is less than 9 in ls output: instead, omit that field
altogether. Reported by, and suggested fix from, Ferdinand.
Jim Meyering [Tue, 21 Jan 2003 08:57:13 +0000 (08:57 +0000)]
[! weak_alias]: Define __-prefixed names to publicized ones.
[! defined _LIBC]: Define-away weak_alias and internal_function.
[defined weak_alias]: Guard each use of weak_alias.
Jim Meyering [Sat, 18 Jan 2003 18:36:13 +0000 (18:36 +0000)]
(Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]: New member.
(enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
(long_options): Add option --dereference-command-line-symlink-to-dir.
(main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
-d, -F, -l options is specified.
(decode_switches): Handle --dereference-command-line-symlink-to-dir.
(gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
Change --dereference-command-line (-H) to dereference *all*
command line arguments, including broken symlinks.
Jim Meyering [Sat, 18 Jan 2003 18:01:51 +0000 (18:01 +0000)]
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.
Jim Meyering [Wed, 15 Jan 2003 13:09:00 +0000 (13:09 +0000)]
(General output formatting): Reflect option name change:
s/--dereference-command-line/--dereference-command-line-symlink-to-dir/.
Say that this option changes how ls treats only symlinks to directories
specified on the command line.
Jim Meyering [Wed, 15 Jan 2003 11:59:07 +0000 (11:59 +0000)]
(gobble_file): Fall back on using lstat when required:
when --dereference (-L) is not specified, and
- when operating on a dangling symlink
- when operating on command-line-symlink-to-directories
This fixes numerous problems. Here are examples:
- `ls dangling-symlink' would fail with `no such file...'
Now it prints `dangling-symlink'.
- `ls -i symlink' would mistakenly print the inode of the referent.
Now it prints the inode of the symlink. Likewise for --size (-s).
Based on a patch from Michael Stone.
Reported by Deepak Goel as Debian bug #173793.