summaryrefslogtreecommitdiff
path: root/src/dd.c
AgeCommit message (Collapse)Author
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.
2004-06-20(input_seek_errno): Declare file-scoped variable as static.Jim Meyering
2004-06-03Fix bug reported by Buciuman Adrian inJim Meyering
<http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html> where 'dd' created a file that was too large. The bug was that dd assumed that the input file offset does not advance after a failed read; but POSIX says that the input file offset is undefined after a failed read. (MAX_BLOCKSIZE): New macro. (input_seekable, input_seek_errno, input_offset, input_offset_overflow): New vars. (scanargs): Reject block sizes greater than MAX_BLOCKSIZE. (advance_input_offset): New function. (skip_via_lseek): Set errno to zero when reporting our failure, so that we don't report based on garbage errno. (skip): If fdesc is standard input, advance the input offset. Do not quit if reading, and if noerror was specified; POSIX seems to require this. If read fails on output file, report the earlier lseek failure instead; this fixes a FIXME in dd_copy. (advance_input_after_read_error): New function. (dd_copy): Use it, instead of assuming that failed reads do not advance the file pointer. Advance input offset after nonfailed reads. Advance only a partial block if the previous read (before the failed read) succeeded, and do not generate an output block of zeros in this case. (main): Determine initial input offset, seekability of input, and error if it wasn't seekable.
2004-04-15(ROUND_UP_OFFSET, PTR_ALIGN): Remove.Jim Meyering
All uses replaced by ptr_align.
2004-04-08(flags, usage): Remove noctty flag.Jim Meyering
(main): Always use O_NOCTTY when opening files.
2004-04-08(set_fd_flags): Undo part of today's change: it's a littleJim Meyering
cleaner -- and more efficient in the common case -- to go ahead and OR in the -1 when fcntl fails.
2004-04-08(dd_copy): Mark two diagnostics for translations.Jim Meyering
2004-04-08(LONGEST_SYMBOL): Tweak comment.Jim Meyering
2004-04-08(set_fd_flags): Don't OR in -1 when fcntl fails.Jim Meyering
Rename parameter, flags, to avoid shadowing global.
2004-04-08New dd conv= symbols nocreat, excl, fdatasync, fsync,Jim Meyering
and new dd options iflag= and oflag=. (usage): Document. (fdatasync) [!HAVE_FDATASYNC]: New macro. (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros. (input_flags, output_flags): New vars. (LONGEST_SYMBOL): New macro. (struct symbol_value): Renamed from struct conversion. Members symbol and value renamed from convname and conversion. The symbol value is now an array instead of a pointer; this saves a bit of space and time in practice. All uses changed. (conversions): Add nocreat, excl, fdatasync, fsync. Now const. (flags): New constant array. (iflag_error_msgid, oflag_error_msgid): New constants. (parse_symbols): Renamed from parse_conversion and generalized to handle either conversion or flag symbols. (scanargs): Adjust uses of parse_symbols accodingly. Add support for iflag= and oflag=. Reject attempts to use both excl and nocreat. (set_fd_flags): New function. (dd_copy): Just return X rather than calling quit (X), since our caller invokes quit with the returned value. Add support for fdatasync and fsync. (main): Add support for iflags=, oflags=, and new conv= symbols.
2004-01-21(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
(dd_copy): Exit with status EXIT_FAILURE, not 2, on errors. (write_output, skip, dd_copy): Don't assume EXIT_FAILURE == 1, as POSIX doesn't require it.
2003-12-20(apply_translations): Don't prohibit conv=unblock,sync.Jim Meyering
2003-11-05Cast NULL to `(char *)' in call to variadic function,Jim Meyering
parse_long_options, so that it works even on systems for which sizeof char* != sizeof int.
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-09-18revert previous changeJim Meyering
2003-09-18Update AUTHORS definition to be a comma-separated list of strings and/or updateJim Meyering
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
2003-07-25(usage): Document the fact that SIGUSR1 makes ddJim Meyering
output its current record counts. Reported by Jurriaan.
2003-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-06-17(main): Call initialize_main.Jim Meyering
2003-05-14(usage): Don't use `,' as the thousands separatorJim Meyering
in e.g. 1,000,000 and 1,048,576. Instead, do this: `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
2002-11-10(interrupt_handler): Use raise, rather than kill+getpid.Jim Meyering
2002-11-05(print_stats, main):Jim Meyering
Use primitives from inttostr.h, not human.h, to print large numbers simply.
2002-10-06(scanargs): Ensure that specified block sizes (specifiedJim Meyering
via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX. (skip, dd_copy): Adapt to new safe_read ABI.
2002-09-22Remove all inclusions of inttypes.h,Jim Meyering
since it's already included from sys2.h via system.h.
2002-09-14(main, skip): Add casts to avoid warnings aboutJim Meyering
`comparison between signed and unsigned'.