summaryrefslogtreecommitdiff
path: root/src/dircolors.c
AgeCommit message (Collapse)Author
2011-05-26maint: accommodate gcc's -Wstrict-overflow optionJim Meyering
* src/factor.c (factor_using_pollard_rho): Change type of "i" to unsigned to avoid warning from gcc's -Wstrict-overflow. * src/expr.c: Use an unsigned intermediate. * src/dircolors.c (main): Reorder operations to avoid the risk of pointer overflow. * src/tr.c (squeeze_filter): Change NOT_A_CHAR from an anonymous "enum" to an "int", to avoid this warning: tr.c:1624:10: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] * src/pr.c (main): Make index "i" unsigned.
2011-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2010-01-01maint: update all FSF copyright year lists to include 2010Jim Meyering
Use this command: git ls-files | grep -v COPYING \ | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \ build-aux/update-copyright
2009-11-07build: consistently use freopen-saferEric Blake
cat, head, ptx, shuf, tac, tail, tee, tr, and uniq used freopen on stdout, and were potentially vulnerable. dircolors, du, and tsort only used it on stdin, which is unaffected by freopen_safer, but this covers all uses for consistency. * cfg.mk (sc_require_stdio_safer): New rule. * gl/modules/xfreopen (Depends-on): Add freopen-safer. * gl/lib/xfreopen.c (includes): Use stdio--.h. * src/ptx.c (includes): Likewise. * src/shuf.c (includes): Likewise. * src/uniq.c (includes): Likewise. * src/dircolors.c (includes): Likewise. * src/du.c (includes): Likewise. * src/tsort.c (includes): Likewise.
2009-09-21doc: mention the texinfo documentation in --helpPádraig Brady
* src/system.h: Rename emit_bug_reporting_address() to emit_ancillary_info() and update it to not print the translation project address in en_* locales, and _do_ print it in the 'C' (and other) locales so that it's included in the default man page. Also mention how to invoke the texinfo documentation for each command. Also move the "hard-locale.h" include to the 8 files that now use it. * man/help2man: Strip the newly added texinfo reference from the --help output as a more verbose version is already added by help2man. Suggestion from C de-Avillez
2009-08-25global: convert indentation-TABs to spacesJim Meyering
Transformed via this shell code: t=$'\t' git ls-files \ | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \ | grep -vE 'tests/pr/|help2man' \ | xargs grep -lE "^ *$t" \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2009-06-11ls --color: do not colorize files with multiple hard links by defaultKamil Dudka
* src/ls.c: Rename hl->mh, do not colorize files with multiple hard links by default. * src/dircolors.c: Rename HARDLINK -> MULTIHARDLINK, hl -> mh. * src/dircolors.hin: Do not colorize files with multiple hard links by default. * tests/Makefile.am: Rename the test case accordingly. * tests/ls/multihardlink: Additionally test ls' default behavior and factor out some duplication. * NEWS: Mention the change in behavior.
2009-05-17maint: use ARRAY_CARDINALITY moreJim Meyering
* src/sort.c (main): Use ARRAY_CARDINALITY, rather than open-coding it. * src/factor.c (WHEEL_END): Likewise. * src/csplit.c (main): Likewise. * src/od.c: Likewise, * src/ls.c (main): Likewise. (N_ENTRIES): Remove definition. Use ARRAY_CARDINALITY instead. * src/dircolors.c: Likewise. (array_len): Remove definition.
2009-02-10ls: clean up after wrapped+colored file names with clear-to-EOLJim Meyering
This change addresses a relatively unusual case: ls --color, with a highlighted name being printed initially in the last row of a terminal emulator (possibly followed by other lines of output) such that it is wrapped onto the following line, as the terminal emulator scrolls the output. That would cause the entire following line to be highlighted, even if the name happened to use only one position. The least-invasive patch would have made colorized output larger for all uses. The approach taken below is more invasive, but limits the increase in overhead to only those lines that are expected to wrap. * src/ls.c (enum indicator_no): Add C_CLR_TO_EOL. (indicator_name): Add "cl". (color_indicator): Add default escape codes for "cl". (print_long_format): Propagate width to print_name_with_quoting. (print_name_with_quoting): Print new C_CLR_TO_EOL string if needed. Return the width of what we're printing. (print_file_name_and_frills): Propagate width. (print_type_indicator): Return bool (aka width). (print_many_per_line): Pass column position to print_* function. (print_current_files): Likewise. (print_horizontal): Likewise. (print_with_commas): Likewise. * src/dircolors.c (slack_codes): Add "CLRTOEOL". (ls_codes): Add "cl". * tests/ls/color-clear-to-eol: New file. Test for this fix. * tests/Makefile.am (TESTS): Add ls/color-clear-to-eol. * THANKS: Update. Reported by Alexander V. Lukyanov. See thread for details: http://thread.gmane.org/gmane.linux.kernel/740021/focus=14824 Thanks to Jan Engelhardt for helping me reproduce the problem. Demonstrate with this in an 80-column xterm: seq 200 # to start in the "bottom" row touch zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo env LS_COLORS='*.foo=0;31;42' ls -og --color=always Before the fix, you'd see something like this: (where the file name is printed in red on a green background, and each "=" denotes a space on a green background) ... -rw-r--r-- 1 0 Feb 5 11:31 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\ zzzzzzzzzzzzzz.foo=================================================== After the patch, the trailing green spaces are gone: -rw-r--r-- 1 0 Feb 5 11:31 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\ zzzzzzzzzzzzzz.foo
2008-10-28ls: --color now highlights hard linked files, tooKamil Dudka
* src/ls.c (print_color_indicator): Colorize hard linked files. * src/dircolors.c: Add color for hard link. * src/dircolors.hin: Add color for hard link. * tests/ls/hardlink: Test for ls - colorize hard linked files. * tests/Makefile.am (TESTS): Add ls/hardlink. * NEWS: Mention the change.
2008-08-01ls: --color now highlights files with capabilities, tooKamil Dudka
* src/ls.c: [HAVE_CAP] Include <sys/capability.h>. (has_capability): New function for capability detection. (print_color_indicator): Colorize file with capability. * m4/jm-macro.m4: New configure option: --disable-libcap. Check for libcap usability. * src/Makefile.am (dir_LDADD, ls_LDADD, ...): Append $(LIB_CAP). * src/dircolors.c: Update color lists. * src/dircolors.hin: Mention new CAPABILITY color attribute. * tests/ls/capability: Test for ls - colorize file with capability. * tests/Makefile.am (root_tests): Add ls/capability. * NEWS: Mention the change.
2008-06-16remove redundant const directivesJim Meyering
In 1463824d8e7f72c31f1d803d7cfe2b608ccafc5c, I added some missing "const" directives, as well as some new, redundant ones. This removes the redundant ones. Pointed out by Eric Blake. * base64.c, cat.c, chcon.c, chgrp.c, chmod.c, chown.c, comm.c: * cp.c, csplit.c, cut.c, date.c, dd.c, df.c, dircolors.c, du.c: * env.c, expand.c, fmt.c, fold.c, groups.c, head.c, id.c: * install.c, join.c, kill.c, ln.c, ls.c, md5sum.c, mkdir.c: * mkfifo.c, mknod.c, mktemp.c, mv.c, nice.c, nl.c, od.c: * paste.c, pathchk.c, pinky.c, pr.c, ptx.c, readlink.c, rm.c: * rmdir.c, runcon.c, seq.c, shred.c, shuf.c, sort.c, split.c: * stat.c, stty.c, su.c, sum.c, tac.c, tail.c, tee.c, timeout.c: * touch.c, tr.c, truncate.c, tty.c, uname.c, unexpand.c, uniq.c: * wc.c, who.c: Remove redundant const directives. * maint.mk (sc_const_long_option): Don't require redundant "const".
2008-06-14add "const" attribute, where possibleJim Meyering
* maint.mk (sc_const_long_option): New rule. Enforce global change. * src/base64.c (long_options): Use "const" where possible. * src/cat.c (main): Likewise. * src/chcon.c (long_options): Likewise. * src/chgrp.c (long_options): Likewise. * src/chmod.c (long_options): Likewise. * src/chown.c (long_options): Likewise. * src/comm.c (long_options, OUTPUT_DELIMITER_OPTION): Likewise. * src/cp.c (long_opts): Likewise. * src/csplit.c (longopts): Likewise. * src/cut.c (longopts): Likewise. * src/date.c (long_options): Likewise. * src/dd.c (conversions, flags, statuses): Likewise. * src/df.c (long_options): Likewise. * src/dircolors.c (long_options): Likewise. * src/du.c (long_options): Likewise. * src/env.c (longopts): Likewise. * src/expand.c (longopts): Likewise. * src/fmt.c (long_options): Likewise. * src/fold.c (longopts): Likewise. * src/groups.c (longopts): Likewise. * src/head.c (long_options): Likewise. * src/id.c (longopts): Likewise. * src/install.c (long_options): Likewise. * src/join.c (longopts): Likewise. * src/kill.c (long_options): Likewise. * src/ln.c (long_options): Likewise. * src/ls.c (long_time_format, long_options, sort_functions): Likewise. * src/md5sum.c (long_options): Likewise. * src/mkdir.c (longopts): Likewise. * src/mkfifo.c (longopts): Likewise. * src/mknod.c (longopts): Likewise. * src/mktemp.c (longopts): Likewise. * src/mv.c (long_options): Likewise. * src/nice.c (longopts): Likewise. * src/nl.c (longopts): Likewise. * src/od.c (charname, long_options): Likewise. * src/paste.c (longopts): Likewise. * src/pathchk.c (longopts): Likewise. * src/pinky.c (longopts): Likewise. * src/pr.c (long_options): Likewise. * src/ptx.c (long_options): Likewise. * src/readlink.c (longopts): Likewise. * src/rm.c (long_opts): Likewise. * src/rmdir.c (longopts): Likewise. * src/runcon.c (long_options): Likewise. * src/seq.c (long_options): Likewise. * src/shred.c (long_opts): Likewise. * src/shuf.c (long_opts): Likewise. * src/sort.c (monthtab, long_options): Likewise. * src/split.c (longopts): Likewise. * src/stat.c (long_options): Likewise. * src/stty.c (mode_info, control_info, longopts, set_mode) Likewise. (set_control_char, speeds): Likewise. * src/su.c (longopts): Likewise. * src/sum.c (longopts): Likewise. * src/tac.c (longopts): Likewise. * src/tail.c (long_options): Likewise. * src/tee.c (long_options): Likewise. * src/timeout.c (long_options): Likewise. * src/touch.c (longopts): Likewise. * src/tr.c (long_options): Likewise. * src/truncate.c (longopts): Likewise. * src/tty.c (longopts): Likewise. * src/uname.c (uname_long_options, arch_long_options): Likewise. * src/unexpand.c (longopts): Likewise. * src/uniq.c (longopts): Likewise. * src/wc.c (longopts): Likewise. * src/who.c (longopts): Likewise.
2008-06-08standardize some error messagesBo Borgerson
* maint.mk: (sc_error_message_warn_fatal, sc_error_message_uppercase): (sc_error_message_period): Add automatic checks for non-standard error messages. * .x-sc_error_message_uppercase: explicit exclusion for this check * src/cp.c: Standardize some error messages. * src/date.c: Likewise. * src/dircolors.c: Likewise. * src/du.c: Likewise. * src/expr.c: Likewise. * src/install.c: Likewise. * src/join.c: Likewise. * src/ln.c: Likewise. * src/mv.c: Likewise. * src/od.c: Likewise. * src/pr.c: Likewise. * src/split.c: Likewise. * src/truncate.c: Likewise. * src/wc.c: Likewise. * tests/du/files0-from: Expect new error message. * tests/misc/join: Likewise. * tests/misc/split-a: Likewise. * tests/misc/wc-files0-from: Likewise. * tests/misc/xstrtol: Likewise. * lib/xmemxfrm.c: Likewise.
2008-06-03use gnulib's progname moduleJim Meyering
* bootstrap.conf (gnulib_modules): Add progname. * src/*.c (program_name): Remove declaration. * (main): Call set_program_name rather than setting program_name. * src/nice.c (main): Cast program_name to "(char *)". * src/prog-fprintf.c: Include "system.h" * src/system.h: Include "progname.h". * maint.mk (sc_program_name): Adjust rule. Suggestion from Eric Blake.
2008-06-02declare program_name consistentlyJim Meyering
* src/base64.c: Likewise. * src/basename.c: Likewise. * src/cat.c: Likewise. * src/chcon.c: Likewise. * src/chgrp.c: Likewise. * src/chmod.c: Likewise. * src/chown.c: Likewise. * src/chroot.c: Likewise. * src/cksum.c: Likewise. * src/comm.c: Likewise. * src/cp.c: Likewise. * src/csplit.c: Likewise. * src/cut.c: Likewise. * src/date.c: Likewise. * src/dd.c: Likewise. * src/df.c: Likewise. * src/dircolors.c: Likewise. * src/dirname.c: Likewise. * src/du.c: Likewise. * src/echo.c: Likewise. * src/env.c: Likewise. * src/expand.c: Likewise. * src/expr.c: Likewise. * src/factor.c: Likewise. * src/fmt.c: Likewise. * src/fold.c: Likewise. * src/groups.c: Likewise. * src/head.c: Likewise. * src/hostid.c: Likewise. * src/hostname.c: Likewise. * src/id.c: Likewise. * src/install.c: Likewise. * src/join.c: Likewise. * src/kill.c: Likewise. * src/link.c: Likewise. * src/ln.c: Likewise. * src/logname.c: Likewise. * src/ls.c: Likewise. * src/md5sum.c: Likewise. * src/mkdir.c: Likewise. * src/mkfifo.c: Likewise. * src/mknod.c: Likewise. * src/mktemp.c: Likewise. * src/mv.c: Likewise. * src/nice.c: Likewise. * src/nl.c: Likewise. * src/nohup.c: Likewise. * src/od.c: Likewise. * src/paste.c: Likewise. * src/pathchk.c: Likewise. * src/pinky.c: Likewise. * src/pr.c: Likewise. * src/printenv.c: Likewise. * src/printf.c: Likewise. * src/ptx.c: Likewise. * src/pwd.c: Likewise. * src/readlink.c: Likewise. * src/rm.c: Likewise. * src/rmdir.c: Likewise. * src/runcon.c: Likewise. * src/seq.c: Likewise. * src/setuidgid.c: Likewise. * src/shuf.c: Likewise. * src/sleep.c: Likewise. * src/sort.c: Likewise. * src/split.c: Likewise. * src/stat.c: Likewise. * src/stty.c: Likewise. * src/su.c: Likewise. * src/sum.c: Likewise. * src/sync.c: Likewise. * src/tac.c: Likewise. * src/tail.c: Likewise. * src/tee.c: Likewise. * src/test.c: Likewise. * src/timeout.c: Likewise. * src/touch.c: Likewise. * src/tr.c: Likewise. * src/true.c: Likewise. * src/tsort.c: Likewise. * src/tty.c: Likewise. * src/uname.c: Likewise. * src/unexpand.c: Likewise. * src/uniq.c: Likewise. * src/unlink.c: Likewise. * src/uptime.c: Likewise. * src/users.c: Likewise. * src/wc.c: Likewise. * src/who.c: Likewise. * src/whoami.c: Likewise. * src/yes.c: Likewise.
2008-05-26convert single-author programs to use proper_nameJim Meyering
g grep -E -l 'define AUTHORS "[^,]+"$'|xargs perl -pi -e \ 's/(define AUTHORS) ("[^,]+")$/$1 proper_name ($2)/'
2008-02-17Adjust dircolors to match ls.c.Jim Meyering
* src/dircolors.hin: comment out NORMAL and FILE, define RESET. * src/dircolors.c (slack_codes) Add "RESET". (ls_codes): Add "rs".
2007-08-22Don't include "getline.h".Jim Meyering
That file has just been removed from gnulib; its declarations are now in <stdio.h>. * src/md5sum.c: Likewise. * src/dircolors.c: Likewise.
2007-07-23Update all copyright notices to use the newer form.Jim Meyering
2007-07-10Change "version 2" to "version 3" in all copyright notices.Jim Meyering
2007-03-28Help translators include translation team's web or email address.Jim Meyering
* src/system.h (emit_bug_reporting_address): New function. * src/base64.c: Use it rather than a literal printf. * src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c: * src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c: * src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c: * src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c: * src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c: * src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c: * src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c: * src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c: * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c: * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c: * src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c: * src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c: * src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c: * src/who.c, src/whoami.c, src/yes.c: Likewise.
2007-02-15* bootstrap.conf (gnulib_modules): Add c-strcase. Remove strcase.Paul Eggert
* src/dircolors.c: Include c-strcase.h. (dc_parse_stream): Use c_strcasecmp rather than strcasecmp to avoid unreliable results in locales like Turkish where strcasecmp is incompatible with the C locale.
2007-01-26Adjust to today's change to gnulib, which added a module forPaul Eggert
string.h to replace the little include files like strcase.h. * src/dircolors.c: Don't include strcase.h. * src/system.h: Don't include mempcpy.h, memrchr.h, stpcpy.h, strpbrk.h.
2006-10-25* src/cat.c (infile): Add "const" to declaration.Jim Meyering
* src/csplit.c (prefix): Likewise. * src/printf.c (cfcc_msg): Likewise. * src/tail.c (valid_file_spec): Likewise. * src/cut.c (cut_file): Likewise, for a parameter. * src/expr.c (str_value): Likewise. * src/fold.c (fold_file): Likewise. * src/pr.c (init_header): Likewise. * src/dircolors.c (dc_parse_stream): Likewise, for a local. * src/tr.c (make_printable_str): Likewise. * src/nl.c (body_type, header_type, footer_type, current_type): (separator_str, build_type_arg, nl_file): Likewise, for many. * src/paste.c (main): Don't assign a read-only string to 'optarg'. * src/tac.c (separator, tac_seekable, copy_to_temp): Likewise.
2006-09-03Don't include dirname.h, since system.h does it now.Paul Eggert
2006-08-26Include <config.h> unconditionally, since we now assume config.h exists.Paul Eggert
2006-07-09Adjust to today's renaming changes in system.h.Paul Eggert
2006-03-26(guess_shell_syntax): Use new last_component.Jim Meyering
2005-10-24rename array_cardinality to array_lenJim Meyering
2005-10-24(ls_codes): Add missing comma.Jim Meyering
Anonymous report and patch from http://savannah.gnu.org/bugs/?func=detailitem&item_id=14849
2005-10-24Add a compile-time assertion that the slack_codesJim Meyering
and ls_codes arrays have the same number of elements. This would have prevented the above-fixed bug.
2005-10-19(append_quoted): Quote ' correctly.Jim Meyering
Problem reported by Eric Blake.
2005-09-24Use `#ifdef HAVE_CONFIG_H', not `#if HAVE_CONFIG_H', for consistency with ↵Jim Meyering
gnulib.
2005-09-22Include strcase.h.Paul Eggert
2005-09-05Colorize set-user-ID and set-group-ID files and sticky,Jim Meyering
other-writable, and sticky-and-other-writable directories. (slack_codes): Add new dircolors mode names. (ls_codes): Add corresponding two-letter ls mode strings. From Mike Frysinger, based on a patch from Fedora.
2005-08-12Add bulletproofing in case stdin is closed.Jim Meyering
(have_read_stdin): Remove global variable. (dc_parse_stream): Always use stdin (freopen, if needed) rather than sometimes using fopen to get a new file descriptor. Call fclose unconditionally. (main): Don't close stdin here. If needed, now it's already done by dc_parse_stream.
2005-08-12(dc_parse_file): Remove comment about now-removed OPENOPTS.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-12Assume `free (NULL)' works.Jim Meyering
2005-04-11(dc_parse_file): Don't assume fopen does not return stdin.Paul Eggert
2005-03-26(parse_line): Use char *, not unsigned char *. This avoids casts.Paul Eggert
(dc_parse_stream, main): Avoid casts. Adjust to simpler data structure generated by new dcgen.
2004-08-02(have_read_stdin, append_quoted,Paul Eggert
dc_parse_stream, dc_parse_file, main): Use bool for booleans. (dc_parse_stream): Use enum for state, rather than int. Use ssize_t to store getline result.
2004-06-21(main): Standardize on the diagnostics given when someone givesJim Meyering
too few operands ("missing operand after `xxx'") or too many operands ("extra operand `xxx'"). Include "quote.h" and/or "error.h" if it wasn't already being included.
2004-01-21(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
(usage): Don't bother normalizing exit status since the arg is already the correct exit status now.
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings. Update the call to parse_long_options so that `AUTHORS, NULL' are the last parameters. * src/true.c (main): Append NULL to version_etc argument list. * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-09-18(WRITTEN_BY): Rename from AUTHORS.Jim Meyering
Begin each WRITTEN_BY string with `Written by ' and end it with `.'. Mark each WRITTEN_BY string as translatable.
2003-07-23Include xstrndup.h.Jim Meyering
(xstrndup): Remove function, now that it's been factored out into it's own file.
2003-06-17(main): Call initialize_main.Jim Meyering