summaryrefslogtreecommitdiff
path: root/src/ls.c
AgeCommit message (Collapse)Author
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.
2001-10-20(usage): Improve the description of --dereference (-L).Jim Meyering
2001-10-20Declare some local variables to be `const', where appropriate.Jim Meyering
2001-09-17(usage): Fix typo in -g usage.Jim Meyering
-H now means --dereference-command-line.
2001-09-04(get_link_name): Update use of xreadlink.Jim Meyering
2001-09-01(get_link_name): Restore error-handling that was removed by preceding delta.Jim Meyering
2001-09-01Include "xreadlink.h".Jim Meyering
(get_link_name): Don't use PATH_MAX. Rewrite to use xreadlink.
2001-08-14(AUTHORS): Mark string for translation, since it contains the English word ↵Jim Meyering
`and'.
2001-08-12Work around non-compliant gettimeofday on Mac OS X 10.0.4,Jim Meyering
(aka Darwin 1.3.7) that caused the date of the first file listed in long output to be the current time rather than the file's mtime. The real work is in m4/gettimeofday.m4 and the wrapper function, lib/gettimeofday.c. Include gtod.h. (main): `Call' GETTIMEOFDAY_INIT. (print_long_format): Add a comment about gettimeofday.
2001-08-10(print_long_format): Simplify previous patch forJim Meyering
listing negative sizes, by adding OFF_T_MAX - OFF_T_MIN + 1 instead of doing a fancy conditional shift. This is simpler and it avoids GCC's bogus compile-time warning about shift counts. (As a bonus, it is portable to hosts that do not use twos-complement arithmetic. :-)
2001-08-10(print_long_format): Multiply the shift width by zeroJim Meyering
to avoid a warning from gcc on hosts with an unsigned type for the st_size member.