summaryrefslogtreecommitdiff
path: root/src/ls.c
AgeCommit message (Collapse)Author
2006-11-27Improve the check for departures from C89, and fix the departuresPaul Eggert
I found. * Makefile.maint (my-distcheck): Also check for C89 compatibility as best we can with GCC. * src/stat.c (PRINTF_OPTION): Omit comma before } in enum declaration; C89 doesn't allow this. * src/dcgen: Don't generate string literals longer than what C89 requires support for. * src/cut.c (usage): Don't use string literals longer than what C89 requires support for. * src/date.c (usage): Likewise. * src/dd.c (usage): Likewise. * src/du.c (usage): Likewise. * src/ls.c (usage): Likewise. * src/od.c (usage): Likewise. * src/readlink.c (usage): Likewise. * src/seq.c (usage): Likewise. * src/shred.c (usage): Likewise.
2006-11-16* bootstrap.conf (gnulib_modules): Add sys_stat, since we use it directly too.Paul Eggert
* lib/.cvsignore, lib/.gitignore: Add root-dev-ino.c, root-dev-ino.h. * m4/.cvsignore, m4/.gitignore: Add root-dev-ino.m4. * src/ls.c (DIRED_FPUTS_LITERAL, PUSH_CURRENT_DIRED_POS): Omit unnecessary parenthesization of args. * src/od.c (EQUAL_BLOCKS): Likewise. * src/system.h (STREQ, ASSIGN_STRDUPA): Likewise.
2006-10-11* src/ls.c (usage): Correct description of -s, --size.Jim Meyering
It works even without -l. Suggestion from Karl Berry.
2006-10-10* src/ls.c (quote_name): Use initializer rather than memset toPaul Eggert
initialize an object to zero. This is easier to read and is less likely to introduce an runtime error due to a mixup. It causes gcc -W to issue a warning, but you can work around this by appending -Wno-missing-field-initializers. * src/pathchk.c (portable_chars_only): Likewise. * src/shred.c (main): Likewise. * src/stty.c (main): Likewise. * src/tr.c (card_of_complement): Likewise. * src/wc.c (wc): Likewise.
2006-09-03Don't include dirname.h, since system.h does it now.Paul Eggert
2006-08-28* src/copy.c (copy_internal): Don't test whether macros likePaul Eggert
S_ISLNK are defined, since they're always defined now. * src/cp.c (main): Likewise. * src/ln.c (main): Likewise. * src/ls.c (get_link_name, make_link_name): Likewise. * src/mkfifo.c (usage): Likewise. * src/who.c (S_IWGRP): Likewise.
2006-08-27* src/system.h (DOT_OR_DOTDOT): Remove macro. Rewrite as a...Jim Meyering
(dot_or_dotdot): ...new static inline function. * src/remove.c (rm_1): Reflect this renaming. * src/ls.c (basename_is_dot_or_dotdot): Likewise.
2006-08-26"ls --color" would highlight other-writable and sticky directoriesJim Meyering
no differently than regular directories on a file system with dirent.d_type support. * NEWS: Say the above. * src/ls.c (gobble_file): With --color, also stat the file when we know it is a directory. Derived from an anonymous one-line fix and bug report: <https://savannah.gnu.org/bugs/?15043>. * tests/ls/color-dtype-dir: New file. Test for the above fix. * tests/ls/Makefile.am (TESTS): Add color-dtype-dir.
2006-08-23(SA_RESTART): Fallback define.Paul Eggert
2006-08-21Add a bootstrap procedure, so that the CVS version contains fewerPaul Eggert
files and we bootstrap the rest from gnulib, gettext, etc. * README-cvs: New file. * bootstrap: New file. * bootstrap.conf: New file. * .x-sc_trailing_blank: Remove config-log, .gdb-history. Add .po. * configure.ac (AC_PREREQ): Move here from m4/*.m4, for benefit of gnulib-tool. (gl_DEFAULT_POSIX2_VERSION, gl_USE_SYSTEM_EXTENSIONS, gl_PERL): (gl_IGNORE_UNUSED_LIBRARIES): Remove; now done by gnulib. (gl_EARLY): Add. (gl_MACROS): Call just after gl_EARLY, just for clarity. * src/c99-to-c98.diff: Remove patch to ls.c; no longer needed. * src/kill.c (strtoimax): Remove decl. * src/ls.c: Include "wcwidth.h" instead of rolling it ourselves. * src/wc.c: Likewise. * src/ls.c (sort_files): Rewrite to avoid need for C99-style declaration, so that we don't need to patch this file. * src/printf.c (strtoimax, strtoumax): Remove decls. * src/su.c: Include getpass.h. (getpass): remove. * src/system.h: Include mempcpy.h, stpcpy.h, strpbrk.h. Include inttypes.h unconditionally; remove decls it handles. * lib/Makefile.am: include gnulib.mk, so that we can remove most of this file. (AM_CPPFLAGS): Don't mention -I$(srcdir), since that's now done for us. (noinst_LIBRARIES, LDDADD, DEFS): Remove. (libcoreutils_a_SOURCES): Trim down greatly, just to the files that aren't in gnulib. Remove defns gnulib does for us. * m4/check-decl.m4 (gl_CHECK_DECLS): Don't include stdio.h, string.h, stdlib.h, unistd.h, sys/time.h, time.h. Use AC_CHECK_DECLS_ONCE for free, getenv, geteuid, getlogin, getuid, lseek, malloc, memchr, realloc. Don't check for getutent, memrchr, nanosleep, stpcpy, strndup, strnlen, strstr, strtoul, strtoull. (_gl_DECL_HEADERS): Remove; all uses removed. * m4/jm-macros.m4 (gl_MACROS): Move AC_PREREQ into configure.ac for the benefit of gnulib-tool. Call gl_INIT. Do not call or require macros that gnulib will handle for us. Don't check for fchmod, hasmntopt, isascii, lchown, listmntent, mempcpy, realpath, wcrtomb, tzset. (gl_CHECK_ALL_HEADERS): Don't check for sys/statvfs.h, sys/vfs.h, sys/mount.h. (gl_CHECK_ALL_TYPES): Require AC_TYPE_UNSIGNED_LONG_LONG_INT. Don't check for struct stat.st_blksize. Don't require AC_STRUCT_ST_DM_MODE, gt_TYPE_SSIZE_T, gl_AC_TYPE_UINT32_T, gl_AC_TYPE_UINTMAX_T, gl_AC_TYPE_UINTPTR_T, gl_AC_TYPE_UNSIGNED_LONG_LONG. * m4/prereq.m4 (gl_PREREQ): Require gl_FUNC_XFTS, gl_ROOT_DEV_INO. Don't require macros that gnulib does for us. * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Don't check for sys/sysmacros.h. Don't check for statvfs. Use AC_CHECK_HEADERS_ONCE for netinet/in.h, nfs/nfs_clnt.h, nfs/vfs.h. Don't require gl_AC_TYPE_LONG_LONG, gt_HEADER_INTTYPES_H.
2006-08-17ls -CF would misalign columns in some cases.Jim Meyering
* src/ls.c (get_type_indicator): New function. extracted from... (print_type_indicator): ...here. Use it. (length_of_file_name_and_frills): Use it here, too, rather than assuming stat.st_mode is valid. Reported by Andreas Schwab, here: <http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/7774> FIXME: add a test for this: FYI, I did ls -CF /proc and visually inspected the result.
2006-08-09Add a compile-time check to ensure that filetypeJim Meyering
and filetype_letter have the same number of elements.
2006-07-26* src/ls.c (print_color_indicator): Test for S_IFREG first, ratherJim Meyering
than having the code test for all of the other types first. Hoist the set-uid/gid-testing code "up" into this new block. Classify any other type of file (e.g., S_TYPEISSHM, etc.) as C_ORPHAN, not as C_FILE. * doc/coreutils.texi (What information is listed): Mention that missing pieces of information are marked with "?". From Paul Eggert.
2006-07-26Checking in a change from Paul.Jim Meyering
2006-07-25 Paul Eggert <eggert@cs.ucla.edu> * src/ls.c (DT_INIT): Remove. All uses removed. (enum filetype): Use an ordinary enum rather than trying to keep the values in sync with DT_FIFO etc. That way, we don't have to make special assumptions about them. All uses changed. (whiteout): New constant member of enum filetype. (filetype_letter): New constant, for use with enum filetype. (FILETYPE_INDICATORS): New initializer list. (print_dir): Add case for DT_WHT. (gobble_file): If stat fails, don't discard information from readdir; instead, preserve it so it can be printed. (print_long_format): Fall back on readdir result if stat info is not available. Use "?" to denote each unknown mode char, instead of an overall "?", since we now know some of the mode typically. (print_type_indicator): Now that MODE isn't necessarily useful, guard all uses. Now that two blocks in the type-checking tree can set "type = C_FILE", move the suffix-handling code out and down.
2006-07-26Prepare for the above change.Jim Meyering
* src/ls.c [struct fileinfo] (stat_ok): Rename from stat_failed, and adjust uses. From a patch by Paul Eggert.
2006-07-26* src/ls.c: Correct indentation/formatting in a few places.Jim Meyering
2006-07-25* src/ls.c (gobble_file): When handling a stat-failed entry,Jim Meyering
print the entry name not the absolute_name -- to be consistent with the usual case. * tests/ls/stat-failed: Update accordingly.
2006-07-25* src/dircolors.hin: Mention that ORPHAN refers not just to dangling symlinks.Jim Meyering
2006-07-25Get --dired offsets right when handling stat-failed entries.Jim Meyering
* src/ls.c (print_long_format): Be careful to increment P by the appropriate amount, even when inode_number_width and nlink_width are zero. * tests/ls/stat-failed: Test for the above.
2006-07-25* src/ls.c (gobble_file) [USE_ACL]: Don't use-uninitialized theJim Meyering
have_acl member. That would happen for a directory with both a non-stat'able entry and one with an ACL.
2006-07-25* src/ls.c (gobble_file): Make it so failure to stat aJim Meyering
non-command-line file provokes an exit status of 1, not 0. Say "cannot access" rather than "cannot stat". * tests/ls/stat-failed: New file/test, for the above. * tests/ls/Makefile.am (TESTS): Add stat-failed.
2006-07-25* src/ls.c: Declare stat_failed to be "bool", not "int" everywhere.Jim Meyering
2006-07-25* src/ls.c [enum filetype] (command_line): Remove member. Not needed.Jim Meyering
Replace all occurrences of "type == command_line" with the equivalent, "command_line_arg".
2006-07-25* src/ls.c: Apply the stat-failed parts of Red Hat'sJim Meyering
coreutils-selinux.patch. From Ulrich Drepper. This makes it so files not mentioned on the command line (e.g., names read from a directory that *is* mentioned on the command line) for which stat fails are still listed. With --color, such files are colored just like ORPHANs (aka dangling symlinks).
2006-07-21(FILE_TYPE_INDICATOR_OPTION): Reposition this new name so the list remains ↵Jim Meyering
alphabetized.
2006-07-21Fix another bug: ls --indicator-style=file-type would callJim Meyering
stat for a symlink, even though it wasn't always needed. In some cases, that unnecessary stat would cause ls to fail. * src/ls.c (gobble_file): Don't treat symlinks specially (in requiring a stat syscall). Remove the offending exclusion. * NEWS: Mention the fix. * tests/ls/stat-dtype: New file/test, for the above fix. Also exercises the new df feature, below.
2006-07-20Fix a bug: ls --file-type worked like --indicator-style=slash,Jim Meyering
rather than like --indicator-style=file-type. (FILE_TYPE_INDICATOR_OPTION): New enum member. (long_options): Map "file-type" to FILE_TYPE_INDICATOR_OPTION, not to 'p'. (decode_switches): Handle new case: FILE_TYPE_INDICATOR_OPTION.
2006-07-19* src/ls.c (print_dir): Give a better diagnostic for failed opendir.Jim Meyering
2006-07-09Adjust to today's renaming changes in system.h.Paul Eggert
2006-07-05* src/ls.c (usage): Correct the description of -G: it is usefulJim Meyering
only in a long listing. Reported by Martin Pool in <https://launchpad.net/distros/ubuntu/+source/coreutils/+bug/51653>.
2006-06-28* src/system.h (CLOSEDIR): Remove. All uses changed to closedir.Paul Eggert
2006-05-30(usage): Add `v' to the list of sorting-related options.Jim Meyering
From Justin Pryzby.
2006-05-03*** empty log message ***Jim Meyering
2006-05-03(DEFINE_SORT_FUNCTIONS, LIST_SORTFUNCTION_VARIANTS):Jim Meyering
Use better macro parameter names: s/basename/key_name/, s/basefunc/key_cmp_func. Fix typo in comment.
2006-05-03(main): On systems with d_type, directories_first onlyJim Meyering
implies format_needs_type, not format_needs_stat.
2006-05-03(xstrcoll_df_version, rev_xstrcoll_df_version): Add space after commaJim Meyering
in arg list, from Eric Blake.
2006-04-23(sort_type): Rearrange to use as an array index whenJim Meyering
choosing sort function; added new sort_numtypes member for compile-time check. (time_type): Add new time_numtypes member for compile-time check. (directories_first): New global variable. (GROUP_DIRECTORIES_FIRST_OPTION): New enum. (long_options): Add --directories-first. (main): Support new option. (is_directory): New function. (extract_dirs_from_files): Use it. (DIRFIRST_CHECK, DEFINE_SORT_FUNCTIONS) (LIST_SORTFUNCTION_VARIANTS): New macros. (sort_functions): New global variable. (sort_files): Use it. (usage): Document new option.
2006-04-17(HAVE_ST_DM_MODE): Remove; moved to ../lib/filemode.c.Paul Eggert
(print_long_format): Use (new) filemodestring rather than (old) mode_string, so that we get more file types right, at least in theory. Adjust to filemode changes.
2006-03-26(basename_is_dot_or_dotdot): Use new last_component, in place of base_name.Jim Meyering
2006-03-06(usage): Mention that -f disables --color.Paul Eggert
2006-02-26In ls, avoid calling stat for --inode (-i), when possible.Jim Meyering
(main): Prefer dirent.d_ino to stat when possible. (gobble_file): Add inode argument. (print_dir): Pass inode if available. (usage): Remove inaccuracy.
2006-01-10(gobble_file): Use DTTOIF only if it's defined.Jim Meyering
This is necessary for Dragonfly. Patch by Joerg Sonnenberger.
2005-12-17Switch back from HAVE_ACL to USE_ACL: The acl() syscallJim Meyering
is no requirement for ACL support; particularly, it does not exist on systems that have POSIX ACLs.
2005-11-17(basename_is_dot_or_dotdot): Correct wording in comment.Jim Meyering
2005-11-08(decode_switches): ls now defaults to --time-style='locale', which inPaul Eggert
turn acts like --time-style='posix-long-iso' if the locale settings are messed up.
2005-11-07(usage): Fix descriptions of --sort, --time.Jim Meyering
2005-10-15(decode_switches): Warn about the deprecated --kilobytes option.Jim Meyering
2005-09-16Include stat-time.h, and use its functions instead of the obsoletePaul Eggert
TIMESPEC_NS macro.
2005-09-05Colorize set-user-ID and set-group-ID files and sticky,Jim Meyering
other-writable, and sticky-and-other-writable directories. (indicator_no[]): Add new symbols. (indicator_name[]): Add corresponding mode strings. (color_indicator[]): Add an entry for each new mode string. (print_color_indicator): Honor new types. From Mike Frysinger, based on a patch from Fedora.
2005-08-14(long_time_expected_width): Revert last change, just toJim Meyering
be paranoid, and add a comment explaining why. Paul Eggert mentioned the possibility.