summaryrefslogtreecommitdiff
path: root/src/ls.c
AgeCommit message (Collapse)Author
2003-03-07(dired_dump_obstack): Use putchar, not fputs, to output a single character.Jim Meyering
2003-01-27(quote_name): Add fourth parameter, width, into which toJim Meyering
store the screen columns, and return the number of bytes instead. (print_dir): Pass NULL as fourth parameter of quote_name. (print_name_with_quoting): Likewise. (length_of_file_name_and_frills): Get the width from the fourth parameter of quote_name instead of return value.
2003-01-27(decode_switches): If `dired' is set withoutJim Meyering
`format == long_format', then silently reset dired. This doesn't change the behavior of ls (all prior uses of dired were protected by `&& format == long_format'), and lets us... (DIRED_INDENT): ... remove `format == long_format' conjunct. (PUSH_CURRENT_DIRED_POS): Likewise. (main): Likewise.
2003-01-18(Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]: New member.Jim Meyering
(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.
2003-01-18Change ls -H back to the way it was yesterday, since this isJim Meyering
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.
2003-01-15(gobble_file): Fall back on using lstat when required:Jim Meyering
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.
2003-01-15Rename ls's --dereference-command-line (-H)Jim Meyering
option to --dereference-command-line-symlink-to-dir. [enum Dereference_symlink] (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from DEREF_COMMAND_LINE_ARGUMENTS. Update all uses. (long_options): Rename the option. (usage): Say that --dereference-... changes how ls treats only symlinks to directories specified on the command line.
2003-01-14(gobble_file): Fix a bug introduced in 4.5.4 that made itJim Meyering
so that ls --color would no longer highlight the names of files with the execute bit set when not specified on the command line. Patch by Michael Stone. Reported by Stephen Depooter as Debian bug 175135.
2003-01-03Include "dev-ino.h".Jim Meyering
[struct dev_ino]: Remove declaration.
2002-12-15Remove all uses of `PARAMS'.Jim Meyering
2002-12-15Remove declaration of nstrftime.Jim Meyering
Include strftime.h instead.
2002-12-06(gobble_file): Also stat the file if it's aJim Meyering
regular file and --indicator-style=classify (aka -F).
2002-12-01ls is now more efficient: it no longer needs to stat each directoryJim Meyering
entry on systems with valid dirent.d_type. (print_dir): Add DT_LNK and DT_REG. (main): Make --recursive set format_needs_type, not format_needs_stat. (gobble_file): Remove a FIXME comment, now that this is fixed.
2002-12-01(gobble_file): Remove the block of code that causedJim Meyering
`ls --color -F symlink-to-dir' to list the files in `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just like `ls -F symlink-to-dir') but with the addition of highlighting.
2002-11-23(decode_switches): Use case-sensitive matching toJim Meyering
decode the QUOTING_STYLE environment variable. This is more consistent with the documentation, and with --quoting-style.
2002-11-12(HAVE_SYMLINKS): Remove unnecessary macro definition.Jim Meyering
Replace sole use with equivalent `#ifdef S_ISLNK'. Inconsistency reported by Dmitry V. Levin.
2002-11-10(sighandler): Handle SIGTSTP specially.Jim Meyering
Based on suggestions from Solar Designer and Dmitry V. Levin. Add comments.
2002-11-10(restore_default_color_handler, sigtstp_handler): Remove functions.Jim Meyering
(sighandler): New function, based on the one in sort.c. (main): Use sigaction, if possible; otherwise signal. Handle these signals: SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP. Don't register our handler if the signal is already being ignored.
2002-11-09correct indentationJim Meyering
2002-11-09ls --color: restore terminal state (color) upon signal.Jim Meyering
Include "full-write.h" and <signal.h>. (restore_default_color, restore_default_color_handler): New functions. (sigtstp_handler, put_indicator_direct): New functions. (main) [print_with_color]: Register signal handlers. Patch mostly by Solar Designer and Stanislav Ievlev.
2002-11-06(print_long_format, print_file_name_and_frills):Jim Meyering
Use primitives from inttostr.h, not human.h, to print large numbers simply. (human_output_opts): New var. (output_block_size): Now uintmax_t, not int, to handle larger block sizes. All uses changed. (file_output_block_size): New var, to distinguish file sizes from other sizes. (decode_switches): Set it.
2002-09-22Remove all inclusions of inttypes.h,Jim Meyering
since it's already included from sys2.h via system.h.
2002-08-29(print_dir): Detect and diagnose readdir failures.Jim Meyering
On some systems (at least EMC Celerra and Solaris5.8), this appears to be necessary. (print_dir): Rename local variable: reading -> dirp.
2002-08-29(print_dir): Rename local variable: reading -> dirp.Jim Meyering
2002-07-08(enum time_style): Remove posix_iso_time_style.Jim Meyering
Add long_iso_time_style. (time_style_args, time_style_types, decode_switches): Likewise. (decode_switches): If a time style is prefixed by "posix-", ignore it if in the POSIX locale. Default style is now posix-long-iso. (usage): Explain the above.
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-06-21(LOGIN_NAME_MAX): Define if not already defined.Jim Meyering
(ID_LENGTH_MAX): Define. (ST_DM_MODE): New macro. Code moved from... (print_long_format): ...here. (print_long_format): Itemize and comment the individual parts of init_bigbuf. Use the above *_MAX macros.
2002-06-15(st_author) [! HAVE_STRUCT_STAT_ST_AUTHOR]: New macro.Jim Meyering
(print_author): New var. (AUTHOR_OPTION): New enum val. (long_options, decode_switches, print_long_format, usage): Support --author. (format_user): New function. (print_long_format): Use it. Make print buffer a bit bigger.
2002-06-01Remove use of D_TYPE_IN_DIRENT, now that that symbol has been renamed.Jim Meyering
2002-05-21(S_ISLNK, S_ISFIFO S_ISSOCK S_ISCHR S_ISBLK S_ISDOOR): Remove definitions.Jim Meyering
2002-02-28(decode_switches, usage): Add --time-style=+FORMAT.Jim Meyering
2002-02-26Include "acl.h" rather than <sys/acl.h>.Jim Meyering
(USE_ACL): Remove; replaced by HAVE_ACL everywhere. (gobble_file): Use file_has_acl rather than doing it ourselves.
2002-01-21Don't include "xalloc.h", as system.h already does that via sys2.h.Jim Meyering
2002-01-20Avoid undefined behavior when strcoll fails,Jim Meyering
by resorting the directory with strcmp instead. Include <setjmp.h>. Include "quote.h". (compare_atime, rev_cmp_atime, compare_ctime, rev_cmp_ctime, compare_mtime, rev_cmp_mtime, compare_size, rev_comp_size, compare_name, rev_cmp_name, compare_extension, rev_cmp_extension, compare_version, rev_compare_version): Move before use, so that we can remove the forward declaration. Reimplement in terms of the new functions described below, using xstrcoll instead of strcoll. (failed_strcoll): New var. (xstrcoll): New function. (V): New type. (cmp_ctime, compstr_ctime, rev_str_ctime): New functions. (cmp_mtime, compstr_mtime, rev_str_mtime): Likewise. (cmp_atime, compstr_atime, rev_str_atime): Likewise. (cmp_size, compstr_size, rev_str_size): Likewise. (cmp_version): Likewise. (cmp_name, compstr_name, rev_str_name): Likewise. (cmp_extension, compstr_extension, rev_str_extension): Likewise. (sort_files): Use prototype for internal function var. If the strcoll-based comparison fails, fall back on a strcmp-based one.
2002-01-08(long_time_format): Extended translator comments.Jim Meyering
2001-12-21(usage): Deprecate --kilobytes. Document size suffixes.Jim Meyering
2001-12-02Use new macros, HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions.
2001-11-27The change of 2001-11-01 introduced a bug whereby some recursiveJim Meyering
listings didn't have a blank line between per-directory groups of files. (print_dir): Print a newline before each directory name except the first one, rather than after each except the last, since now (after the changes of 2001-11-01) detecting whether a `pending*' is the last would involve more work. Reported by Andreas Schwab. This change has no net effect. (main): Remove always-true conjunct and add a comment.
2001-11-26Don't include "gtod.h"Jim Meyering
(main): Don't `call' GETTIMEOFDAY_INIT.
2001-11-23(usage): Note that ``Mandatory arguments to long options are mandatoryJim Meyering
for short options too.''
2001-11-23Split usage strings so that --help and --versionJim Meyering
descriptions are alone in their own string.
2001-11-23(usage): Split --help output into smaller pieces.Jim Meyering
Use fputs, not printf.
2001-11-03(DEV_INO_PUSH): Avoid unnecessary copies.Jim Meyering
(dev_ino_pop): Likewise.
2001-11-02(dev_ino_pop): Cast 2nd arg of obstack_blank to `int'Jim Meyering
before negating to avoid warning from gcc on systems with 64-bit size_t. Rename global: s/trace_dirs/recursive/. (extract_dirs_from_files): Rename parameter: s/recursive/ignore_dot_and_dot_dot/.
2001-11-02Use XREALLOC. It's cleaner.Jim Meyering
2001-11-02Use XMALLOC in a several places. It's cleaner.Jim Meyering
2001-11-01Include dirfd.h.Jim Meyering
(print_dir): If dirfd fails, resort to using stat.
2001-11-01(struct pending) [st_ino, st_dev]: Remove just-added members.Jim Meyering
(queue_directory): Remove just-added 3rd parameter and associated code, and update callers. (print_dir): Get dev/inode pair via `fstat (dirfd (reading), ...', and call visit_dir to detect cycles here. Push the dev/inode pair onto the new stack. (dev_ino_obstack): New global. (DEV_INO_PUSH): New macro. (dev_ino_pop): New function. (ASSERT_MATCHING_DEV_INO): New macro. (visit_dir): Take two parameters (dev,ino), not one `pending'. (main): Initialized the dev_ino_obstack. Don't call visit_dir here. Get the dev/ino pair from the new stack, not from the pending entry.
2001-11-01Make ls -R detect directory cycles.Jim Meyering
Include hash.h, same.h, and xalloc.h. (INITIAL_TABLE_SIZE, LOOP_DETECT): Define. (active_dir_set): New global. (struct dev_ino): Declare. (dev_ino_hash, dev_ino_compare, dev_ino_free): New functions. (visit_dir, free_pending_ent): New functions. (main): Initialize the active_dir_set hash table, if necessary. Don't confuse a marker entry with a real one. Detect loops. Manage the set of active directories. Free the hash table. (queue_directory): Add a new parameter. Ensure that we set the new dev/ino members for each enqueued directory. Update all callers. (print_dir): Don't confuse a marker entry with a real one. (extract_dirs_from_files): Insert a marker entry before inserting the entries for subdirectories.
2001-11-01Don't try to print a NULL pointer.Jim Meyering
(main): Don't use ARGMATCH_TO_ARGUMENT. This reverts part of the 1998-12-31 change.