summaryrefslogtreecommitdiff
path: root/src/od.c
Commit message (Collapse)AuthorAgeFilesLines
* all: further adjustments for new Ronna, Quetta SI prefixesPádraig Brady2023-01-061-1/+1
| | | | | | | | | | | | | | * src/dd.c (parse_integer): Support Q,R suffixes. * src/od.c (main): Likewise. * src/split.c (main): Likewise. * src/stdbuf.c (parse_size): Likewise. * src/truncate.c (main): Likewise. * src/sort.c (specify_size_size): Likewise. Also line length syntax check fix. * tests/misc/numfmt.pl: Adust top end large number checks to the new largest values. * doc/coreutils.texi (numfmt invocation): Add a numfmt example. * NEWS: Tweak to aid searchability.
* numfmt: add support for new SI prefixesPaul Eggert2023-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | * src/dd, src/head.c, src/od.c, src/sort.c, src/stdbuf.c, src/tail.c: (usage): * src/system.h (emit_size_note): Mention new SI prefixes. * src/du.c (main): * src/head.c (head_file): * src/numfmt.c (suffix_power, suffix_power_char, prepare_padded_number): * src/shred.c (main): * src/sort.c (unit_order): * src/tail.c (parse_options): Support new SI prefixes. * src/numfmt.c (MAX_ACCEPTABLE_DIGITS): Increase to 33. (zero_and_valid_suffixes, valid_suffixes): New constants, with new SI prefixes. (valid_suffix, unit_to_umax): Use them. (prepare_padded_number): Diagnose "999Q" instead of "999Y". * tests/misc/numfmt.pl, tests/misc/sort.pl: Adjust tests to match new max.
* maint: update all copyright year number rangesPádraig Brady2023-01-011-1/+1
| | | | | | | | | | Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
* maint: fix recent syntax-check failuresPádraig Brady2022-09-251-1/+2
| | | | | | | * .gitignore: Add new headers from gnulib. * src/basenc.c: Adjust line length due to replacement of 'verify' with 'static_assert'. * src/od.c: Likewise.
* maint: prefer static_assert to verifyPaul Eggert2022-09-151-6/+7
| | | | | | | | | | * bootstrap.conf: Add assert-h. * gl/lib/randperm.c: Do not include verify.h. * gl/lib/randperm.c, src/basenc.c, src/dd.c, src/digest.c: * src/dircolors.c, src/expr.c, src/factor.c, src/ls.c, src/numfmt.c: * src/od.c, src/seq.c, src/shred.c, src/sort.c, src/stat.c: Prefer C23’s static_assert to nonstandard verify. * gl/modules/randperm (Depends-on): Add assert-h.
* maint: update all copyright year number rangesPádraig Brady2022-01-021-1/+1
| | | | | | | | | 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.
* maint: prefer MAYBE_UNUSEDPaul Eggert2021-11-181-8/+9
| | | | | | | Prefer MAYBE_UNUSED to _GL_UNUSED, since the C2x syntax will be [[maybe_unused]] at the start of the declaration, and we want to look forward to that. All uses of _GL_UNUSED either changed to MAYBE_UNUSED, or (when not needed) removed.
* maint: prefer attribute.h in .c filesPaul Eggert2021-10-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | This will help us make the transition to C2x, where some attributes must come at the start of function decls. Leave the attributes alone in .h files for now, as the Gnulib tradition is to not expose attribute.h to users. * bootstrap.conf (gnulib_modules): Add ‘attribute’. * gl/lib/randperm.c, src/make-prime-list.c, src/system.h: Include attribute.h. * gl/lib/strnumcmp.c (strnumcmp): Remove _GL_ATTRIBUTE_PURE here, as this belongs in the .h file. * gl/lib/strnumcmp.h (strnumcmp): Add _GL_ATTRIBUTE_PURE here. * src/sort.c (human_numcompare, numcompare): Now ATTRIBUTE_PURE; discovered due to strnumcmp.h change. * gl/lib/randperm.c, src/copy.c, src/dd.c, src/df.c, src/digest.c: * src/env.c, src/expr.c, src/factor.c, src/ls.c: * src/make-prime-list.c, src/numfmt.c, src/od.c, src/pathchk.c: * src/pinky.c, src/pr.c, src/ptx.c, src/realpath.c, src/relpath.c: * src/seq.c, src/sort.c, src/stat.c, src/stty.c, src/system.h: * src/tr.c, src/uniq.c, src/wc.c: In .c files, crefer ATTRIBUTE_CONST to _GL_ATTRIBUTE_CONST, and similarly for ATTRIBUTE_FORMAT and ATTRIBUTE_PURE. * src/system.h (FALLTHROUGH): Remove; attribute.h defines it.
* maint: use clearerr on stdin when appropriatePaul Eggert2021-08-221-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is so that commands like ‘fmt - -’ read from stdin both times, even when it is a tty. Fix some other minor issues that are related. * src/blake2/b2sum.c (main): * src/cksum.c (cksum): * src/cut.c (cut_file): * src/expand-common.c (next_file): * src/fmt.c (fmt): * src/fold.c (fold_file): * src/md5sum.c (digest_file, digest_check): * src/nl.c (nl_file): * src/od.c (check_and_close): * src/paste.c (paste_parallel, paste_serial): * src/pr.c (close_file): * src/sum.c (bsd_sum_file): Use clearerr on stdin so that stdin can be read multiple times even if it is a tty. Do not assume that ferror preserves errno as POSIX does not guarantee this. Coalesce duplicate diagnostic calls. * src/blake2/b2sum.c (main): * src/fmt.c (main, fmt): Report read error, even if it's merely fclose failure. * src/fmt.c: Include die.h. (fmt): New arg FILE. Close input (reporting error) if not stdin. All callers changed. * src/ptx.c (swallow_file_in_memory): Clear stdin's EOF flag. * src/sort.c (xfclose): Remove unnecessary feof call.
* maint: while (1) → while (true)Paul Eggert2021-06-261-3/+3
|
* maint: use "char const *" rather than "const char *"Pádraig Brady2021-04-111-14/+14
| | | | | | * cfg.mk (sc_prohibit-const-char): Add a new syntax-check to enforce this style. * *.[ch]: sed -i 's/const char \*/char const */g'
* maint: update all copyright year number rangesPádraig Brady2021-01-011-1/+1
| | | | | | | | | 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.
* maint: adjust to split out xstrtol-error gnulib modulePádraig Brady2020-01-011-0/+1
| | | | | | | | | | * bootstrap.conf: Depend on the new module split from xstrtol. * src/df.c: Include "xstrtol-error.h" for xstrtol_fatal. * src/du.c: Likewise. * src/ls.c: Likewise. * src/od.c: Likewise. * src/pr.c: Likewise. * src/sort.c: Likewise.
* maint: update all copyright year number rangesPádraig Brady2020-01-011-1/+1
| | | | | | | | | 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.
* od: use fseek on non-regular filesPaul Eggert2019-06-191-2/+6
| | | | | | | Problem reported by Szőts Ákos (Bug#36291). * NEWS: Mention this. * src/od.c (skip): Try fseek even on files that do not have usable sizes, falling back on fread if fseek fails.
* maint: update all copyright year number rangesAssaf Gordon2019-01-011-1/+1
| | | | | | | | | 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.
* doc: improve documentation of binary prefixesWodry2018-07-221-0/+1
| | | | | | | | * doc/coreutils.texi (Common options): * src/dd.c, src/head.c, src/od.c, src/stdbuf.c, src/tail.c (usage): * src/system.h (emit_size_note): Mention binary prefixes (Bug#32242). Copyright-paperwork-exempt: Yes
* maint: update all copyright year number rangesPádraig Brady2018-01-011-1/+1
| | | | | | | | | 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.
* all: prefer HTTPS in URLsPaul Eggert2017-09-191-1/+1
|
* maint: use C99 for loop initial declarations where possiblePádraig Brady2017-06-171-7/+3
| | | | This results in a net reduction of about 120 lines.
* maint: xsetmode renamed to xbinary-ioPaul Eggert2017-02-161-2/+2
| | | | | | | | * 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.
* maint: use xsetmode, not xfreopenPaul Eggert2017-02-151-3/+2
| | | | | | | | | | | | | | | | | | | | | | | 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.
* maint: update all copyright year number rangesPádraig Brady2017-01-011-1/+1
| | | | | | | | | 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.
* doc: fix --help for: od -t f[SIZE]Pádraig Brady2016-12-021-1/+1
| | | | * src/od.c (usage): SIZE is that of float, not integer.
* all: use die() rather than error(EXIT_FAILURE)Pádraig Brady2016-10-161-10/+11
| | | | | | | | 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, ...);
* maint: update all copyright year number rangesPádraig Brady2016-01-011-1/+1
| | | | | | | | | 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.
* all: avoid quoting file names when possiblePádraig Brady2015-11-041-4/+4
| | | | | | | | | | | | | | | | | | 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.
* all: quote string arguments in error messagesPádraig Brady2015-10-271-6/+6
| | | | | | | | | | | 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.
* maint: avoid new coverity warningsPádraig Brady2015-05-301-3/+0
| | | | | | | | | | | | | | | | | | * 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.
* doc: standardize messages about the '-' stdin FILEPádraig Brady2015-04-301-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* maint: update all copyright year number rangesPádraig Brady2015-01-011-1/+1
| | | | | | | | 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.
* rm: fix prompted number of arguments to remove on some platformsPádraig Brady2014-11-271-1/+2
| | | | | | | | | | | | | | | | "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
* wc: don't miscount /sys and similar file systemsPaul Eggert2014-10-071-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* doc: output correct --help references with --program-prefixPádraig Brady2014-09-191-1/+1
| | | | | | | | | * 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.
* maint: prefer 'return status;' to 'exit (status);' in 'main'Paul Eggert2014-09-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* od: add an --endian option to control byte swappingNiels Möller2014-02-091-3/+56
| | | | | | | | | | | | | * 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.
* maint: update all copyright year number rangesBernhard Voelker2014-01-021-1/+1
| | | | | | 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.
* doc: use semicolon instead of period in option descriptionsBenno Schulenberg2013-08-011-3/+3
| | | | | | | | | | | | | | | | | | | 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
* od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_tJim Meyering2013-06-021-3/+3
| | | | | | | | | | | * 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.
* doc: clarify the printable characters output by odPádraig Brady2013-03-221-2/+2
| | | | | | | | | | * 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
* maint: cleanup up various uses of __attribute__Pádraig Brady2013-02-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* maint: define usage note about mandatory args centrallyBernhard Voelker2013-01-231-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* maint: update all copyright year number rangesJim Meyering2013-01-011-1/+1
| | | | | | 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.
* doc: improve od --help and man pagePádraig Brady2012-12-271-24/+31
| | | | | | | | | | | | * 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.
* maint: handle file sizes more reliablyPaul Eggert2012-05-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | 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.
* doc: clarify --help output for some optional argumentsPádraig Brady2012-01-311-2/+2
| | | | | | | | | * 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.
* maint: use single copyright year rangeJim Meyering2012-01-271-1/+1
| | | | Run "make update-copyright".
* maint: adjust formatting of certain continued stringsJim Meyering2012-01-111-6/+9
| | | | | | | | | | | | | | | | | | | 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.
* maint: src/*.[ch]: convert more `...' to '...'Jim Meyering2012-01-091-5/+5
| | | | | | Run this (twice): git grep -E -l '`.+'\' src/*.[ch] \ |xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
* maint: src/*.c: change remaining quotes (without embedded spaces)Jim Meyering2012-01-091-11/+11
| | | | | | Run this (twice): git grep -E -l '`[^ ]+'\' src/*.c \ |xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'