summaryrefslogtreecommitdiff
path: root/src/od.c
AgeCommit message (Collapse)Author
2017-02-16maint: xsetmode renamed to xbinary-ioHEADmasterPaul Eggert
* bootstrap.conf, src/base64.c, src/cat.c, src/cksum.c: * src/head.c, src/md5sum.c, src/od.c, src/split.c, src/sum.c: * src/tac.c, src/tail.c, src/tee.c, src/tr.c, src/wc.c: Adjust to renaming of the xsetmode module to xbinary-io, and of the xsetmode function to xset_binary_mode.
2017-02-15maint: use xsetmode, not xfreopenPaul Eggert
This fixes a bug noted by Eric Blake. Code was using xfreopen to change files to binary mode, but this fails for stdout when in append mode. Such code should use xsetmode instead. This affects only the port on platforms like MS-Windows which distiguish text from binary I/O. * bootstrap.conf (gnulib_modules): Remove xfreopen and add xsetmode. Sort. * src/base64.c (main): * src/cat.c (main): * src/cksum.c (cksum): * src/head.c (head_file, main): * src/md5sum.c (digest_file): * src/od.c (open_next_file): * src/split.c (main): * src/sum.c (bsd_sum_file, sysv_sum_file): * src/tac.c (tac_file, main): * src/tail.c (tail_file): * src/tee.c (tee_files): * src/tr.c (main): * src/wc.c (wc_file): Use xsetmode, not xfreopen.
2017-01-01maint: update all copyright year number rangesPádraig Brady
Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2016-12-02doc: fix --help for: od -t f[SIZE]Pádraig Brady
* src/od.c (usage): SIZE is that of float, not integer.
2016-10-16all: use die() rather than error(EXIT_FAILURE)Pádraig Brady
die() has the advantage of being apparent to the compiler that it doesn't return, which will avoid warnings in some cases, and possibly generate better code. * cfg.mk (sc_die_EXIT_FAILURE): A new syntax check rule to catch any new uses of error (CONSTANT, ...);
2016-01-01maint: update all copyright year number rangesPádraig Brady
Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2015-11-04all: avoid quoting file names when possiblePádraig Brady
Quote file names using the "shell-escape" or "shell-escape-always" methods, which quote as appropriate for most shells, and better support copy and paste of presented names. The "always" variant is used when the file name is embedded in an error message with surrounding spaces. * cfg.mk (sc_error_shell_quotes): A new syntax check rule to suggest quotef() where appropriate. (sc_error_shell_always_quotes): Likewise for quoteaf(). * src/system.h (quotef): A new define to apply shell quoting when needed. I.E. when shell character or ':' is present. (quoteaf): Likewise, but always quote. * src/*.c: Use quotef() and quoteaf() rather than quote() where appropriate. * tests/: Adjust accordingly.
2015-10-27all: quote string arguments in error messagesPádraig Brady
These strings are often file names or other user specified parameters, which can give confusing errors in the presence of unexpected characters for example. * cfg.mk (sc_error_quotes): A new syntax check rule. * src/*.c: Wrap error() string arguments with quote(). * tests/: Adjust accordingly. * NEWS: Mention the improvement.
2015-05-30maint: avoid new coverity warningsPádraig Brady
* src/sync.c (sync_arg): Initialise variable to avoid unitialized access if assert is disabled. * src/head.c (elide_tail_bytes_file): Support this function with ---presume-input-pipe and larger files, which regressed with commit v8.23-47-g2662702. (elide_tail_lines_file): Likewise. * src/dd.c (dd_copy): Explicitly don't try to ftruncate() upon failure to lseek() (the existing check against st_size was already protecting that). * src/factor.c (factor_using_squfof): Assert (only when linting due to performance) to avoid the implication of divide by zero. * src/od.c (read_block): Remove dead code. * src/tac.c (tac_seekable): Likewise. * src/ls.c (gobble_file): Likewise.
2015-04-30doc: standardize messages about the '-' stdin FILEPádraig Brady
* src/system.h (emit_stdin_note): A new function, refactoring the usage note about the '-' FILE implying stdin. * src/base64.c (usage): Use the new function to emit the note in a standard location and with standard separation. * src/cat.c (usage): Likewise. * src/csplit.c (usage): Likewise. * src/cut.c (usage): Likewise. * src/expand.c (usage): Likewise. * src/fmt.c (usage): Likewise. * src/head.c (usage): Likewise. * src/md5sum.c (usage): Likewise. * src/nl.c (usage): Likewise. * src/od.c (usage): Likewise. * src/paste.c (usage): Likewise. * src/pr.c (usage): Likewise. * src/ptx.c (usage): Likewise. * src/shred.c (usage): Likewise. * src/shuf.c (usage): Likewise. * src/sort.c (usage): Likewise. * src/sum.c (usage): Likewise. * src/tac.c (usage): Likewise. * src/tail.c (usage): Likewise. * src/tsort.c (usage): Likewise. * src/unexpand.c (usage): Likewise. * src/wc.c (usage): Likewise. * src/join.c (usage): Adjust the separation used for the message referring to FILE1 or FILE2 as stdin. * src/comm.c (usage): Add a message using the same wording (translation) as used in join. * src/split.c (usage): Reword to using FILE rather than INPUT, allowing use of emit_stdin_note(). Also remove the mention of "fixed-size" pieces as this isn't now always the case. Fixes http://pad.lv/1450179
2015-01-01maint: update all copyright year number rangesPádraig Brady
Run "make update-copyright" and then... * tests/sample-test: Adjust to use the single most recent year. * tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message, so that year is updated automatically in future.
2014-11-27rm: fix prompted number of arguments to remove on some platformsPádraig Brady
"zu" was output on solaris 8 for example rather than the number, since coreutils-8.22. * cfg.mk: Disallow %z, since we don't currently use the gnulib fprintf module, so any usage with it is non portable. Also our usage with error() currently works only through an ancillary dependency on the vfprintf gnulib module. * src/rm.c (main): Use %PRIuMAX rather than %zu for portability. * src/dd.c (alloc_[io]buf): Likewise for consistency. * src/od.c (main): Likewise. * src/split.c (set_suffix_length): Likewise. * NEWS: Mention the rm bug fix. Reported in http://bugs.gnu.org/19184
2014-10-07wc: don't miscount /sys and similar file systemsPaul Eggert
Fix similar problems in head, od, split, tac, and tail. Reported by George Shuklin in: http://bugs.gnu.org/18621 * NEWS: Document this. * src/head.c (elseek): Move up. (elide_tail_bytes_pipe, elide_tail_lines_pipe): New arg CURRENT_POS. All uses changed. (elide_tail_bytes_file, elide_tail_lines_file): New arg ST and remove arg SIZE. All uses changed. * src/head.c (elide_tail_bytes_file): * src/od.c (skip): Avoid optimization for /sys files, where st_size is bogus and st_size == st_blksize. Don't report error at EOF when not optimizing. * src/head.c, src/od.c, src/tail.c: Include "stat-size.h". * src/split.c (input_file_size): New function. (bytes_split, lines_chunk_split, bytes_chunk_extract): New arg INITIAL_READ. All uses changed. Use it to double-check st_size. * src/tac.c (tac_seekable): New arg FILE_POS. All uses changed. (copy_to_temp): Return size of temp file. All uses changed. * src/tac.c (tac_seekable): * src/tail.c (tail_bytes): * src/wc.c (wc): Don't trust st_size; double-check by reading. * src/wc.c (wc): New arg CURRENT_POS. All uses changed. * tests/local.mk (all_tests): Add tests/misc/wc-proc.sh, tests/misc/od-j.sh, tests/tail-2/tail-c.sh. * tests/misc/head-c.sh: * tests/misc/tac-2-nonseekable.sh: * tests/split/b-chunk.sh: Add tests for problems with /proc and /sys files. * tests/misc/od-j.sh, tests/misc/wc-proc.sh, tests/tail-2/tail-c.sh: New files.
2014-09-19doc: output correct --help references with --program-prefixPádraig Brady
* src/system.h (emit_ancillary_info): Take the invariant PROGRAM_NAME as a parameter, so that consistent references are made to online docs and texinfo nodes, when a --program-prefix is in place. Note the man pages don't need this fix as they're generated before the program prefix is used. * NEWS: Mention the improvements in references to online documentation.
2014-09-08maint: prefer 'return status;' to 'exit (status);' in 'main'Paul Eggert
* build-aux/gen-single-binary.sh: Don't use ATTRIBUTE_NORETURN for main functions. * src/base64.c, src/basename.c, src/cat.c, src/chcon.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/getlimits.c, src/groups.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/make-prime-list.c: * src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mktemp.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/nproc.c: * src/numfmt.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/realpath.c, src/rm.c, src/rmdir.c, src/runcon.c: * src/seq.c, src/shred.c, src/shuf.c, src/sleep.c, src/sort.c: * src/split.c, src/stat.c, src/stdbuf.c, src/stty.c, src/sum.c: * src/sync.c, src/tac.c, src/tail.c, src/tee.c, src/timeout.c: * src/touch.c, src/tr.c, src/true.c, src/truncate.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: In 'main' functions, Prefer 'return status;' to 'exit (status);'. * src/coreutils-arch.c (_single_binary_main_uname) (_single_binary_main_arch): * src/coreutils-dir.c, src/coreutils-vdir.c (_single_binary_main_ls) (_single_binary_main_dir, _single_binary_main_vdir): Omit ATTRIBUTE_NORETURN. Return a value. * src/coreutils.c (SINGLE_BINARY_PROGRAM): Omit ATTRIBUTE_NORETURN. (launch_program): Now static. * src/dd.c (finish_up): New function. (quit, main): Use it. * src/getlimits.c (main): Return a proper exit status. * src/test.c (test_main_return): New macro. (main): Use it. * src/logname.c, src/nohup.c, src/whoami.c: Use 'error' to simplify exit status in 'main' function. * src/yes.c (main): Use 'return' rather than 'error' to exit, so that GCC doesn't suggest ATTRIBUTE_NORETURN.
2014-02-09od: add an --endian option to control byte swappingNiels Möller
* src/od.c (main): Handle the new --endian option, taking "little" and "big" as parameters. (usage): Describe the new option. (PRINT_FIELDS): Adjust to swap bytes if required. * tests/misc/od-endian.sh: A new test to verify the byte swapping operations for hex (ints) and floats for all sizes between 1 and 16 inclusive. * test/local.mk: Reference the new test. * doc/coreutils.texi (od invocation): Describe the new option. * NEWS: Mention the new feature.
2014-01-02maint: update all copyright year number rangesBernhard Voelker
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2013-08-01doc: use semicolon instead of period in option descriptionsBenno Schulenberg
Also do not end option descriptions with a period, properly indent continuation lines, and make some tiny clarifications. * src/du.c (usage): Lowercase after semicolon. * src/ls.c (usage): Semicolons instead of periods, small rephrasing and two hyphens for clarity, proper indentation. * src/mktemp.c (usage): Semicolons and lowercase. * src/od.c (usage): Semicolons. * src/ptx.c (usage): Use the standard phrase, clarify default option. * src/setuidgid.c (usage): Properly indent continuation line. * src/split.c (usage): Semicolons, lowercase, no final period. * src/stat.c (usage): Semicolons, lowercase. * src/tail.c (usage): Proper indentation, one shorter rephrasing, semicolons, no final periods. * src/timeout.c (usage): Properly indent, semicolons, no final periods. Fixes http://bugs.gnu.org/14976
2013-06-02od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_tJim Meyering
* src/od.c (PRINT_FIELDS): Declare "i" to be of type uintmax_t, so that the numerator in the expression for "next_pad" does not overflow. (print_named_ascii): Likewise. (print_ascii): Likewise. Bug introduced via commit v6.12-42-g20c0b87. * tests/misc/od.pl: Exercise each of the three affected code paths. * NEWS (Bug fixes): Mention it. Reported by Rich Burridge.
2013-03-22doc: clarify the printable characters output by odPádraig Brady
* src/od.c (usage): Mention any printable character is output, Not just ASCII. * doc/coreutils.texi (od invocation): Further clarify that only single byte characters are output (due to the alignment requirement). Also mention the fact that 3 digit octal sequences are output for non printable characters without a corresponding C escape. Reported in http://bugs.gnu.org/13947
2013-02-20maint: cleanup up various uses of __attribute__Pádraig Brady
* src/cfg.mk (sc_prohibit-gl-attributes): Disallow the __attribute() form without trailing underscores as that is not elided where required. Also ensure we use gnulib macros rather than defining our own. * src/system.h: Remove gnulib provided macros. * src/chown-core.c: Likewise. * src/chroot.c: Likewise. * src/copy.c: Likewise. * src/csplit.c: Likewise. * src/dd.c: Likewise. * src/expr.c: Likewise. * src/extent-scan.c: Likewise. * src/factor.c: Likewise. * src/ls.c: Likewise. * src/od.c: Likewise. * src/paste.c: Likewise. * src/ptx.c: Likewise. * src/sort.c: Likewise. * src/stat.c: Likewise. * src/stty.c: Likewise. * src/system.h: Likewise. * src/tac.c: Likewise. * src/test.c: Likewise. * src/tsort.c: Likewise.
2013-01-23maint: define usage note about mandatory args centrallyBernhard Voelker
Each program with at least one long option which is marked as 'required_argument' and which has also a short option for that option, should print a note about mandatory arguments. Define that well-known note centrally and use it rather than literal printf/fputs, and add it where it was missing. * src/system.h (emit_mandatory_arg_note): Add new function. * src/cp.c (usage): Use it rather than literal printf/fputs. * src/csplit.c, src/cut.c, src/date.c, src/df.c, src/du.c: * src/expand.c, src/fmt.c, src/fold.c, src/head.c, src/install.c: * src/kill.c, src/ln.c, src/ls.c, src/mkdir.c, src/mkfifo.c: * src/mknod.c, src/mv.c, src/nl.c, src/od.c, src/paste.c: * src/pr.c, src/ptx.c, src/shred.c, src/shuf.c, src/sort.c: * src/split.c, src/stdbuf.c, src/tac.c, src/tail.c, src/timeout.c: * src/touch.c, src/truncate.c, src/unexpand.c, src/uniq.c: Likewise. * src/base64.c (usage): Add call of the above new function because at least one long option has a required argument. * src/basename.c, src/chcon.c, src/date.c, src/env.c: * src/nice.c, src/runcon.c, src/seq.c, src/stat.c, src/stty.c: Likewise.
2013-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2012-12-27doc: improve od --help and man pagePádraig Brady
* src/od.c: Redorder the information output by --help to ease interpretation and so that appropriate sections are generated by help2man. * doc/coreutils.texi (od invocation): Fix an incorrect reference to @var{n}, which should be @var{bytes}. * man/od.x: Add an "Examples" section, and move the default od format to there, and add a commonly required format to generate hexdumps. Reported by Akim Demaille in http://bugs.gnu.org/13280.
2012-05-10maint: handle file sizes more reliablyPaul Eggert
Problem reported by Samuel Thibault in <http://bugs.gnu.org/11424>. * NEWS: Document this. * src/dd.c (skip): Handle skipping past EOF on shared or typed memory objects the same way as with regular files. (dd_copy): It's OK to truncate shared memory objects. * src/du.c (duinfo_add): Check for overflow. (print_only_size): Report overflow. (process_file): Ignore negative file sizes in the --apparent-size case. * src/od.c (skip): Fix comment about st_size. * src/split.c (main): * src/truncate.c (do_ftruncate, main): On files where st_size is not portable, fall back on using lseek with SEEK_END to determine the size. Although strictly speaking POSIX says the behavior is implementation-defined, in practice if lseek returns a nonnegative value it's a reasonable one to use for the file size. * src/system.h (usable_st_size): Symlinks have reliable st_size too. * tests/misc/truncate-dir-fail: Don't assume that getting the size of a dir is not allowed, as it's now allowed on many platforms, e.g., GNU/Linux.
2012-01-31doc: clarify --help output for some optional argumentsPádraig Brady
* src/pr.c (usage): Fix the -S description to indicate that the argument is optional for the short option. * doc/coreutils.texi (pr invocation): Likewise. * src/od.c (usage): Fix the -S description to indicate that the argument is required for the short option. Clarify -w takes an argument and that it is optional.
2012-01-27maint: use single copyright year rangeJim Meyering
Run "make update-copyright".
2012-01-11maint: adjust formatting of certain continued stringsJim Meyering
Add a rule to ding any source file that has a continued string with a word in the first column of the following line. Those tend to trigger malfunction in tools that try to map an arbitrary line number to an enclosing function name. Of course, very many strings do precisely this, *when they are part of the usage function*. So we exempt the body of each usage function. * src/dircolors.c (main): Separate a long, continued string into two separately-quoted parts. * src/od.c (decode_one_format): Likewise. (decode_one_format, main): Move a space from end of preceding line to the beginning of the continued line. * src/tr.c (unquote, string2_extend, validate): Likewise. * src/seq.c (main): Split in two and use string concatenation. * src/stat.c (default_format): Use a mix of techniques. * cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): New rule. Exempt three files in src: system.h, od.c, printf.c.
2012-01-09maint: src/*.[ch]: convert more `...' to '...'Jim Meyering
Run this (twice): git grep -E -l '`.+'\' src/*.[ch] \ |xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
2012-01-09maint: src/*.c: change remaining quotes (without embedded spaces)Jim Meyering
Run this (twice): git grep -E -l '`[^ ]+'\' src/*.c \ |xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'
2012-01-09maint: adjust quoting: emit '...', not `...' in diagnosticsJim Meyering
* src/csplit.c (parse_repeat_count, extract_regexp): As above. * src/date.c (main): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (decode_one_format, main): Likewise. * src/pathchk.c (no_leading_hyphen): Likewise. * src/pr.c (main, getoptarg): Likewise. * src/rm.c (diagnose_leading_hyphen): Likewise. * src/sort.c (key_warnings, incompatible_options, main): Likewise. * src/stat.c (print_esc_char): Print '\x', not `\x' in diagnostic. * src/test.c (main): Likewise. * src/touch.c (main): Likewise. * src/tr.c (build_spec_list, validate, append_range): Likewise. * tests/misc/mktemp: This is an unusual case, since the affected string contains only the ` of an `...' string. So we change the long ` to a lone '. * tests/pr/pr-tests: Manual quote adapting fix-up. * tests/ln/hard-to-sym: Likewise. * tests/split/suffix-length: Likewise. * tests/mv/part-fail: Likewise. * tests/misc/chcon: Likewise. * tests/misc/stat-printf: Likewise.
2012-01-07maint: use new emit_try_help in place of equivalent fprintfJim Meyering
Run this command: perl -0777 -pi -e \ 's/fprintf \(stderr, _\("Try `%s --help.*\n.*;/emit_try_help ();/m'\ src/*.c
2012-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2011-12-04od,test: address warnings from gcc's -Wjump-misses-initJim Meyering
* src/test.c (unary_operator): gcc reported that initializations in two case statements were skipped. Enclose in braces. * src/od.c (decode_one_format): Likewise.
2011-08-13maint: remove empty statement after jump labelBernhard Voelker
* src/head.c (elide_tail_bytes_pipe): Remove the empty statement, ";" after a jump label; it is needed only when a declaration follows. * src/kill.c (main): Likewise. * src/od.c (main): Likewise. * src/paste.c (collapse_escapes): Likewise. * src/printf.c (print_formatted): Likewise.
2011-07-02maint: use "const" and "pure" function attributes where possibleJim Meyering
* configure.ac (WARN_CFLAGS): Add -Wsuggest-attribute=const, -Wsuggest-attribute=pure and -Wsuggest-attribute=noreturn. (GNULIB_WARN_CFLAGS): But do not add them here... yet. * src/chown-core.h (chopt_free, uid_to_name): Add function attribute(s). * src/copy.c (is_ancestor, valid_options): Likewise. * src/copy.h (chown_failure_ok): Likewise. * src/dd.c (operand_matches, operand_is): Likewise. * src/df.c (selected_fstype, excluded_fstype): Likewise. * src/expr.c (null looks_like_integer): Likewise. * src/md5sum.c (hex_digits): Likewise. * src/od.c (get_lcm): Likewise. * src/pathchk.c (component_start, component_len): Likewise. * src/pinky.c (count_ampersands): Likewise. * src/pr.c (cols_ready_to_print): Likewise. * src/ptx.c (search_table): Likewise. * src/sort.c (find_unit_order): Likewise. * src/stty.c (mode_type_flag, string_to_baud, baud_to_value): Likewise. * src/system.h (gcd, lcm): Likewise. * src/tr.c (is_char_class_member, look_up_char_class): Likewise. (star_digits_closebracket): Likewise. * src/uniq.c (find_field): Likewise. * src/wc.c (compute_number_width): Likewise. * lib/xfts.h (cycle_warning_required): Likewise. * gl/lib/randint.h (randint_get_source): Likewise. * gl/lib/randperm.c (ceil_lg): Likewise. * gl/lib/randperm.h (randperm_bound): Likewise. * lib/strnumcmp.h (strintcmp): Likewise.
2011-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2010-12-28coreutils: keep lines within 80-column limitsPaul Eggert
* cfg.mk (LINE_LEN_MAX, FILTER_LONG_LINES): New macros. (sc_long_lines): New rule. * HACKING: Use shorter URLs to the same material. * doc/Makefile.am, doc/coreutils.texi, m4/boottime.m4: * man/help2man, man/stdbuf.x, src/Makefile.am, src/cat.c, src/copy.c: * src/cp.c, src/dd.c, src/df.c, src/du.c, src/groups.c, src/install.c: * src/ls.c, src/md5sum.c, src/mv.c, src/od.c, src/pinky.c, src/ptx.c: * src/readlink.c, src/remove.c, src/rmdir.c, src/setuidgid.c: * src/sort.c, src/tail.c, src/touch.c, tests/Coreutils.pm: * tests/cp/existing-perm-race, tests/cp/perm, tests/cp/preserve-gid: * tests/du/2g, tests/du/long-from-unreadable, tests/init.sh: * tests/install/basic-1, tests/ls/nameless-uid: * tests/ls/readdir-mountpoint-inode, tests/misc/chroot-credentials: * tests/misc/cut, tests/misc/date, tests/misc/join, tests/misc/md5sum: * tests/misc/sha1sum, tests/misc/sha224sum, tests/misc/sort: * tests/misc/sort-continue, tests/misc/sort-files0-from: * tests/misc/sort-rand, tests/misc/stdbuf, tests/misc/tr: * tests/misc/uniq, tests/mv/atomic, tests/mv/part-fail: * tests/mv/part-symlink, tests/mv/sticky-to-xpart, tests/pr/pr-tests: * tests/rm/fail-2eperm, tests/rm/interactive-always: Reformat to fit within 80 columns. * doc/Makefile.am (BAD_POSIX_PERL): New macro. * doc/coreutils.texi: Reword slightly, to make menus and index lines shorter. * src/md5sum.c: Redo --help output so that it fits within 79 columns, since that's a bit more portable and all the other --help strings fit in 79 columns.
2010-11-18od: fix bugs in displaying floating-point valuesPaul Eggert
* NEWS: Describe patch. * bootstrap.conf (gnulib_modules): Add ftoastr. * src/od.c: Include ftoastr.h, not float.h. (FLT_DIG, DBL_DIG): Remove. No need to verify LDBL_DIG. (FMT_BYTES_ALLOCATED): No need to worry about floating point now, since this format is no longer used for floating point. (PRINT_FIELDS): New macro, with most of the guts of the old PRINT_TYPE. (PRINT_TYPE): Rewrite to use PRINT_FIELDS. (PRINT_FLOATTYPE): New macro. This uses the new functions from ftoastr. (print_float, print_double, print_long_double): Reimplement using PRINT_FLOATTYPE. (decode_one_format): Calculate field widths based on ftoastr-supplied macros. * tests/Makefile.am (TESTS): Add misc/od-float. * tests/misc/od-float: New file.
2010-05-31maint: make spacing around "=" consistent, even in IF_LINTJim Meyering
E.g., - size_t desired_width IF_LINT (= 0); + size_t desired_width IF_LINT ( = 0); Use this command: g grep -l IF_LINT | grep '\.[ch]$' \ | xargs perl -pi -e 's/(IF_LINT \()= /$1 = /'
2010-05-31maint: replace each "for (;;)" with "while (true)"Jim Meyering
Run this command: git ls-files | grep '\.[ch]$' \ | xargs perl -pi -e 's/for \(;;\)/while (true)/g' ...except for randint.c, which does not include stdbool.h. In that case, use "while (1)". * gl/lib/randint.c (randint_genmax): Use "while (1)" for infloops. * src/cat.c (simple_cat, cat): Use "while (true)" for infloops. * gl/lib/randread.c (readsource, readisaac): Likewise. * src/copy.c (copy_reg): Likewise. * src/csplit.c (record_line_starts, process_regexp): Likewise. * src/cut.c (set_fields): Likewise. * src/dd.c (iread, parse_symbols): Likewise. * src/df.c (find_mount_point, main): Likewise. * src/du.c (main): Likewise. * src/expand.c (expand): Likewise. * src/factor.c (factor_using_division, do_stdin): Likewise. * src/fmt.c (get_space): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (main): Likewise. * src/pr.c (main, read_line): Likewise. * src/shred.c (dopass, genpattern): Likewise. * src/sort.c (initbuf, fillbuf, getmonth, keycompare): Likewise. * src/split.c (bytes_split, lines_split): Likewise. * src/tac.c (tac_seekable): Likewise. * src/test.c (and, or): Likewise. * src/tr.c (squeeze_filter, main): Likewise. * src/tsort.c (search_item): Likewise. * src/unexpand.c (unexpand): Likewise. * src/uniq.c (main): Likewise. * src/yes.c (main): Likewise.
2010-05-25maint: don't emit an extra newline in each of two diagnosticsJim Meyering
* src/shuf.c (main): Remove a stray newline in a diagnostic. * src/od.c (main): Likewise. Detected via these: git grep -A1 'error *(.*,$' | grep -C1 '\\n"[,)]' git grep 'error *(.*;$' | grep '\\n"[,)]'
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-09-23maint: Use logical rather than bitwise operators on boolsPádraig Brady
This is because bitwise operators are: - confusing and inconsistent in a boolean context - non short circuiting - brittle in C89 where bool can be an int (so > 1)
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-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.
2008-11-10use xfreopen in place of unchecked freopenJim Meyering
* bootstrap.conf (modules): Add xfreopen. * src/cat.c (main): Include "xfreopen.h". Use xfreopen. * src/cksum.c (cksum): Likewise. * src/head.c (head_file, main): Likewise. * src/md5sum.c (digest_file): Likewise. * src/od.c (open_next_file): Likewise. * src/split.c (type_undef): Likewise. * src/sum.c (bsd_sum_file, sysv_sum_file): Likewise. * src/tac.c (tac_file, main): Likewise. * src/tail.c (tail_file, main): Likewise. * src/tee.c (tee_files): Likewise. * src/tr.c (main): Likewise. * src/wc.c (wc_file): Likewise. * po/POTFILES.in: Add lib/xfreopen.c
2008-09-19od: ungettextize debugging messagesBenno Schulenberg
2008-09-19od --help: avoid concatening two messages without a newlineBenno Schulenberg
src/od.c (usage): Better: make them into two separate paragraphs.