Age | Commit message (Collapse) | Author |
|
(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.
|
|
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.
|
|
|
|
<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.
|
|
All uses replaced by ptr_align.
|
|
(main): Always use O_NOCTTY when opening files.
|
|
cleaner -- and more efficient in the common case -- to go
ahead and OR in the -1 when fcntl fails.
|
|
|
|
|
|
Rename parameter, flags, to avoid shadowing global.
|
|
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.
|
|
(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.
|
|
|
|
parse_long_options, so that it works even on systems for which
sizeof char* != sizeof int.
|
|
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.
|
|
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
|
|
|
|
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
|
|
output its current record counts. Reported by Jurriaan.
|
|
Don't include closeout.h.
|
|
|
|
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...'
|
|
|
|
Use primitives from inttostr.h, not human.h, to print large numbers simply.
|
|
via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
(skip, dd_copy): Adapt to new safe_read ABI.
|
|
since it's already included from sys2.h via system.h.
|
|
`comparison between signed and unsigned'.
|
|
`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.
|