summaryrefslogtreecommitdiff
path: root/src/dd.c
AgeCommit message (Collapse)Author
2008-03-07dd: avoid unnecessary, but harmless close_stdout call.Jim Meyering
* src/dd.c (close_stdout_required): New global. (maybe_close_stdout): New function. (main): Set the global. Reported by Ulrich Drepper in http://bugzilla.redhat.com/436368
2008-01-31Don't modify argv in dd due to ',' in arguments.Paul Eggert
* src/dd.c: Include quotearg.h. (operand_matches): New function. (parse_symbols, operand_is): Use it. (parse_symbols): 1st arg is now const pointer. Don't modify it. msgid arg is now just the message, not a format. (scanargs): Add some 'const's to check for problems like the above.
2008-01-30Don't modify argv in dd.Paul Eggert
* src/dd.c (operand_is): New function. (scanargs): Use it so that we don't need to modify argv, as a nicety. Problem reported by Adam Goode in <http://lists.gnu.org/archive/html/bug-coreutils/2008-01/msg00264.html>.
2007-12-04Reflect change in gnulib: don't include getpagesize.h,Jim Meyering
now that it's provided by unistd.h. * src/cat.c: Don't include getpagesize.h. * src/copy.c: Likewise. * src/dd.c: Likewise. * src/shred.c: Likewise. * src/split.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-22Honor dd's noatime flag if possible, even if not supported on build fsPaul Eggert
* doc/coreutils.texi (dd invocation): Warn that noatime might not be reliable. * src/dd.c (flags, usage): Look at O_NOATIME, not HAVE_WORKING_O_NOATIME, to decide whether to support the noatime flag, so that dd attempts O_NOATIME even if the build file system does not support it. Problem reported by Jim Meyering today in bug-coreutils. * tests/dd/misc: Generate a warning, not a failure, if noatime exists but fails.
2007-02-10Remove excess leading spaces that would make help2man misbehave.Jim Meyering
* src/printf.c (usage): Remove excess spaces on 2nd line of %b desc. * src/nl.c (usage): Remove excess spaces on 2nd line of pBRE desc. * src/dd.c (usage): Remove excess spaces on 2nd line of sync desc. * src/date.c (usage): Use two spaces after each optional flag, not one. Reported by Thomas Huriaux in <http://bugs.debian.org/410407>.
2007-01-26* src/dd.c (advance_input_after_read_error): Change diagnostic toJim Meyering
say "invalid file offset" rather than "screwy file offset".
2006-12-22* NEWS: dd bs= operands now silently override later ibs= and obs=,Paul Eggert
as POSIX requires. * src/dd.c (scanargs): Implement it. * tests/dd/misc (outbytes): Test it. * doc/coreutils.texi (dd invocation): Specify that bs=N overrides later ibs and obs, undoing part of the previous change. (The behavior was wrong.)
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-16Help valgrind see that there is no leak in dd.c.Jim Meyering
* src/dd.c (dd_copy): Declare real_buf and real_obuf to be static, so we need not free them at all. This is easier than freeing both buffers at each of the early "return"s.
2006-10-17* src/dd.c (usage): Use two spaces (not one) to separate theJim Meyering
"fdatasync" option string from its description, so help2man formats the derived man page properly. Reported by Samuel Thibault in <http://bugs.debian.org/393649>.
2006-10-05* src/dd.c (flags): noatime and nofollow now depend onPaul Eggert
HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW, too. (usage): Output info about noatime and nofollow only if they are known to work. * src/remove.c (AD_push): Inspect HAVE_WORKING_O_NOFOLLOW rather than O_NOFOLLOW, when testing whether it's possible to avoid a race condition reliably.
2006-08-16Fix bugs when printing plurals of numbers that are notPaul Eggert
unsigned long int values. * src/system.h (select_plural): New function. * src/md5sum.c (digest_check): Use select_plural to avoid bug. * src/uptime.c (print_uptime): Likewise. * src/dd.c (print_stats): Likewise. Also, don't use ngettext to print a floating point number, as reducing to 0 or 1 doesn't work for some languages. Instead, just use "s" for seconds since it doesn't need a plural form.
2006-08-15* src/dd.c (print_stats): Don't substitute "1" for number, as thisPaul Eggert
causes confusion for the Hungarian translators. Problem reported by Egmont Koblinger.
2006-08-09Warn about oflag=append without conv=notrunc.Paul Eggert
2006-07-09(apply_translations): Use toupper rather thanPaul Eggert
islower followed by toupper; it's simpler and typically faster now that we assume at least C89 semantics. Similarly for tolower.
2006-07-08* src/dd.c (skip): Remove one of two adjacent "the"s in a comment.Jim Meyering
2006-03-30(iwrite): Remove assignment without effect.Jim Meyering
Reported by Felix Rauch Valenti.
2006-03-08(set_fd_flags): Handle file-creation flags on filePaul Eggert
descriptors, rather than ignoring them.
2006-03-06(flags, usage): New flags directory, nolinks.Paul Eggert
2005-12-07(flags, usage): Add support for noatime flag.Paul Eggert
2005-10-31(skip): Fix off-by-one error reported by Theodoros V. Kalamatianos.Paul Eggert
2005-09-30(main): Don't assume size_t has the same widthPaul Eggert
as unsigned long. Problem reported by Eric Blake.
2005-09-16(main): When failing to truncate, mention both the seek block countJim Meyering
and the block size, in case the block size is very large.
2005-09-13* src/dd.c: Detect some very unlikely buffer overflows.Paul Eggert
(INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP): New macros. (MAX_BLOCKSIZE): Now accepts an arg. All uses changed. (page_size): New var. (scanargs, skip, main): Use more-straightforward way to detect overflow. (dd_copy): Use page_size rather than invoking getpagesize. Use INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP. (main): Set page_size. Avoid a call to stat in the usual case where ftruncate succeeds.
2005-07-09Don't include stdio.h; no longer needed.Paul Eggert
2005-07-03Include fd-reopen.h.Paul Eggert
(open_fd): Remove. All callers changed to use fd_reopen instead.
2005-05-28(skip): Return the number of records that were notPaul Eggert
skipped due to encountering EOF. (dd_copy): If the file wasn't seekable and EOF was encountered, write zeros past EOF until the desired offset is reached.
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-05-06(flags, usage): Add support for "binary" and "text".Paul Eggert
2005-04-18Don't include stat-macros.h directly. system.h does that.Jim Meyering
2005-04-16(S_TYPEISSHM): Remove definition.Jim Meyering
Get the definition by including "stat-macros.h", instead.
2005-04-09(quit): Define with ATTRIBUTE_NORETURN.Jim Meyering
Now that close_stdout closes standard output unconditionally, these workarounds for dd and cat are no longer necessary. (close_stdout_wrapper): Remove function. (main): Call atexit with close_stdout, instead.
2005-04-09(iread, iwrite): Use char * buffer, not void *, so we can do pointerPaul Eggert
arithmetic on it.
2005-04-09Do not include safe-read.h or full-write; no longer needed.Paul Eggert
(process_signals): Add forward decl. (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros. (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro. (SA_NODEFER) [!defined SA_NODEFER]: New macro. (SA_RESETHAND) [!defined SA_RESETHAND]: New macro. (caught_signals, interrupt_signal, info_signal_count, catch_siginfo): New vars. (usage): Mention -USR1 versus -INFO. (cleanup): Don't invoke print_stats; the caller must do it now. All callers changed. (quit): Process signals just before exiting. (interrupt_handler): Simply record the signal and return. (siginfo_handler): Simply increment the signal counter and return. (install_handler): Remove, replacing with: (install_signal_handlers, process_signals, iread, iwrite): New functions. All callers to safe_read and full_write replaced by iread and iwrite. All callers to install_handler replaced by install_handlers. Do not include inttostr.h, no longer needed. (print_stats, main): Rewrite and simplify formats to use PRIuMAX instead of umaxtostr. (print_stats): Work even in languages that have special forms for two of things, for r_truncate and w_bytes. We can't fix delta_s in this way, since ngettext doesn't support floating-point. (main): Rewrite to avoid casts.
2005-03-06Remove `register' keyword.Jim Meyering
2005-02-21Include gethrxtime.h, xtime.h.Paul Eggert
(start_time): Now of type xtime_t, not struct timespec. (print_stats, main): Use gethrxtime rather than gettime.
2004-11-20(flags, usage, main): Add noctty flag to dd.Paul Eggert
2004-11-17(main): Use getopt_long rather than getopt.Paul Eggert
2004-11-16(C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,Paul Eggert
C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS, C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not macros. (STATUS_NOXFER, statuses): New constants. (usage, print_stats, scanargs): Add support for status=noxfer. (usage): Update status output to match new behavior. (print_stats): Always output complete byte count. Put space between numbers and units, as SI requires. Use ngettext so that i18n can use plurals for "byte" and "second". Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact). (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by the string.
2004-11-15Include "human.h".Paul Eggert
(w_bytes, start_time): New vars. (usage): Document new I/O statistics output (print_stats): Output new I/O statistics. (cleanup): Do statistics after closing stdin and stdout, so that the times are more accurate. (write_output, dd_copy): Count output bytes. (main): Get initial value of clock.
2004-09-21(main): Use getopt where it suffices, not getopt_long.Paul Eggert
2004-09-19(usage): Distinguish between options and operands.Paul Eggert
(scanargs): Don't mess with argc, argv; getopt_long handles this now. Say "operands" for operands, not "options". (main): Use getopt_long, so that "dd --" works as POSIX requires.
2004-09-03(usage): "alternated EBCDIC" -> "alternate EBCDIC".Paul Eggert
(bit_count): Remove. All uses changed to.... (multiple_bits_set): New function. (scanargs): Use it, and check separately for each set of incompatible options, to improve diagnostics. (MX): Remove. (apply_translations): Move checks for incompatible options to scanargs, so that they're done consistently.
2004-08-02(translation_needed, parse_integer, scanargs,Paul Eggert
apply_translations, char_is_saved, swab_buffer, skip_via_lseek): Use bool for booleans. (translate_buffer): Use to_uchar rather than a cast. (swab_buffer, copy_simple, copy_with_unblock): Use size_t for sizes.