Age | Commit message (Collapse) | Author |
|
`exit (1)' to `exit (EXIT_FAILURE)', and
`usage (1)' to `usage (EXIT_FAILURE)'.
|
|
|
|
|
|
Declare input_file and output_file to be `const'.
(skip): Declare `file' parameter to be `const', too.
|
|
|
|
(skip_via_lseek) [__linux__]: New function.
(skip): Use skip_via_lseek, not buggy_lseek_support.
|
|
instead of hard-coding --help and --version descriptions.
|
|
just fine on non-tape character devices like /dev/mem and /dev/kmem.
(buggy_lseek_support) [__linux__]: Emulate `skip=N'
behavior using reads, not lseek for Linux tape devices (major == 9).
Kernel lseek support for tapes is broken, up to and including
linux-2.4.16. Reported by Herbert Xu.
|
|
descriptions are alone in their own string.
|
|
Use fputs, not printf.
|
|
possible, as some of them were not conforming to ANSI C, and
they made the code hard to read. Avoiding 'unsigned' cuts
down on the number of casts.
(newline_character, space_character, save_char):
Now char, not unsigned char.
(obuf): Now char *, not unsigned char *.
(ascii_to_ebcdic, ascii_to_ibm, ebcdic_to_ascii):
Now char[], not unsigned char[].
(translate_charset, translate_buffer, swab_buffer, skip, copy_simple,
copy_with_block, copy_with_unblock):
Arg now points to char, not unsigned char.
All callers changed.
(translate_charset, parse_conversion, apply_translations):
Use int index, not unsigned int.
(bit_count): Arg is now int, not unsigned int.
Callers not changed, as they already assumed this.
(translate_buffer): Cast char to unsigned char before using
it as a subscript.
(swab_buffer): Returns char *, not unsigned char *.
(dd_copy): Use char, not unsigned char, for buffers.
Use size_t for possibly-large index, not unsigned int.
|
|
(full_write): Remove decl; not needed.
(open_fd): Don't assume read and write size fits in int.
|
|
`and'.
|
|
pad with spaces.
|
|
|
|
when used with block or unblock.
|
|
(main): Pass a `struct stat *', not stat.st_mode to S_TYPEISSHM.
|
|
|
|
|
|
safe_read, to avoid overflow e.g. on 64-bit Solaris sparc.
(dd_copy): Remove unnecessary cast.
|
|
documented a standard way to do it.
(skip_bytes, seek_bytes): Remove.
(usage): Remove B suffix.
(scanargs, skip, dd_copy, main): Remove support for B suffix.
|
|
at the top of the loop, not at the bottom.
|
|
bytes, but consider RECORDS to be a byte count if COUNT_BYTES
is nonzero.
|
|
(seek_records): Renamed from seek_record, for consistency with
skip_records and max_records. All uses changed.
(usage, scanargs): Remove bseek=n and bskip=n; instead, use seek=nB
and skip=nB.
(enum Unit, Unit): Remove.
(skip, dd_copy, main): Undo most recent change.
(dd_copy, main): Pass blocksize of 1 as appropriate when
skip_bytes or seek_bytes is nonzero.
(main): Rework ftruncate failure diagnostic to always use byte count.
|
|
Fix a merge bug exposed by new test.
|
|
adapt skip to skip either by bytes or by blocks
|
|
(main): Report failed fstat.
Complain only when ftruncate fails on a regular file,
a directory, or a shared memory object.
|
|
|
|
|
|
Based on a patch from Michael Stone.
Reported by andras@kolumbus.fi at http://bugs.debian.org/77174.
|
|
|
|
(buggy_lseek_support): New function.
(skip): Use it.
Frank Adler reported that although _llseek returns 0, lseek
erroneously returns an offset suggesting the operation succeeded
even though it fails.
|
|
impossible and some buggy drivers return zero.
Use SEEK_CUR rather than SEEK_SET; this fixes a bug when the
file descriptor is not currently rewound.
|
|
|
|
(buggy_lseek_support): New function.
(skip): Use it.
Reported by Martin Gallant via Michael Stone.
|
|
`dd if=/dev/fd0 seek=100000000000'.
Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add many, more precise diagnostics.
|
|
From Bob Proulx.
|
|
|
|
(usage): Don't call close_stdout here.
(close_stdout_wrapper): New, kludgey, function and file-scoped global.
(main): Register it with atexit.
|
|
|
|
Don't use SA_INTERRUPT to decide whether to call sigaction, as
POSIX.1 doesn't require SA_INTERRUPT and some systems
(e.g. Solaris 7) don't define it. Use SA_NOCLDSTOP instead;
it's been part of POSIX.1 since day 1 (in 1988).
(install_handler): Use SA_NOCLDSTOP, not _POSIX_VERSION,
to decide whether to call sigaction; this fixes an old typo.
|
|
Change lots of count and index variables to be of unsigned type.
(dd_copy): Add new unsigned variable, n_bytes_read, in place of
many uses of `nread'.
|
|
add a separate `suffix' variable.
|
|
|
|
|
|
(dd_copy): Use those to page-align both the input and output buffers.
|
|
(ROUND_UP_TO_MODULUS): Define.
(dd_copy): Page-align the input buffer.
Based on a patch from Scott Lurndal.
|
|
|
|
for output, to avoid confusion with closed input and output fds.
(input_fd, output_fd): Remove; all uses changed to STDIN_FILENO
and STDOUT_FILENO.
(open_fd): New function.
(main): Use it, instead of open, to ensure that file descriptors
don't get confused.
(skip): Don't fstat the input file; the result is no longer used.
|
|
then open it for write and report an error if we can't seek.
|