Paul Eggert [Fri, 2 Jul 1999 21:25:09 +0000 (21:25 +0000)]
(extr_init, make_directories, extract_archive):
Do not assume mode bits have traditional Unix values.
(set_mode): Use %04 not %0.4 format.
(extract_sparse_file): Do not use data_block uninitialized.
Check for lseek failures; use portable lseek whence values.
Paul Eggert [Fri, 2 Jul 1999 21:05:50 +0000 (21:05 +0000)]
(mode_to_oct): Do not assume internal mode_t and external octal modes
have the same bit patterns.
(start_header): Do not assume mode bits have traditional Unix values.
(finish_sparse_file): Use lseek whence macros instead of integers.
(dump_file): Do not assume mode bits have traditional Unix values.
Do not invoke finish_sparse_file on a negative file descriptor.
Paul Eggert [Fri, 25 Jun 1999 23:28:08 +0000 (23:28 +0000)]
(write_archive_buffer): New function.
(child_open_for_compress, flush_write, flush_read): Use it to write
buffers.
(open_archive): Report error if fstat of archive fails.
Improve efficiency of check for /dev/null.
Also, fix some corner cases with remote archives and /dev/null checking.
(close_archive): Test for input fifo only if not remote.
Truncate output archive only if it's not remote.
Paul Eggert [Sat, 19 Jun 1999 06:19:27 +0000 (06:19 +0000)]
(to_oct): Prepend leading zeros, not spaces.
Output a trailing NUL unless the value won't fit without it;
this is backward compatible with Unix tar (and with GNU Emacs).
(finish_header): No need to append NUL to chksum, now that
to_oct is doing it.
Paul Eggert [Wed, 16 Jun 1999 11:14:15 +0000 (11:14 +0000)]
(backup_type): Remove decl; backupfile.h now has it.
(intconv): Remove; use xstrto* fns instead.
("xstrtol.h"): Include.
(check_decimal): Remove.
(long_options, usage, OPTION_STRING, decode_options):
Remove -y, --bzip2, --unbzip2.
(decode_options): Use xget_version instead of get_version.
Check for overflow with -b and -L and RECORD_SIZE_OPTION.
Replace invocations of check_decimal with xstrtoumax.
Paul Eggert [Mon, 22 Mar 1999 22:06:22 +0000 (22:06 +0000)]
Include <quotearg.h>.
(from_oct): Add forward decl.
(read_header): Return HEADER_FAILURE if we can't parse the checksum.
(from_oct): Report an error only if TYPE is nonzero.
Quote any funny characters in bad header.
Paul Eggert [Tue, 2 Mar 1999 00:10:11 +0000 (00:10 +0000)]
(to_oct): New parameter substitute, giving a substitute value to use
when the original value is out of range. Do not append a space to the
output; modern tars don't. When a value is out of range, specify the
maximum value, not the number of bits.
(GID_NOBODY, UID_NOBODY): New macros.
(gid_to_oct, uid_to_oct): Use them as substitutes.
(finish_header): Do not assume that UINTMAX_TO_OCT appends a space.
(dump_file): Check whether the file changed as we read it.
Paul Eggert [Tue, 2 Mar 1999 00:10:11 +0000 (00:10 +0000)]
(gid_from_oct, major_from_oct, minor_from_oct, mode_from_oct, off_from_oct,
size_from_oct, time_from_oct, uid_from_oct, uintmax_from_oct):
Use TYPE_MAXIMUM instead of macros like OFF_MAX, which are not reliable
(e.g. OFF_MAX in AIX 4.2 is incorrect).
Paul Eggert [Wed, 27 Jan 1999 20:42:30 +0000 (20:42 +0000)]
(gid_to_oct, major_to_oct, minor_to_oct, mode_to_oct, off_to_oct,
size_to_oct, time_to_oct, uid_to_oct): Cast value to uintmax_t, for
benefit of pre-ANSI compilers with long long.
Paul Eggert [Wed, 27 Jan 1999 20:42:30 +0000 (20:42 +0000)]
(gid_from_oct, major_from_oct, minor_from_oct, mode_from_oct,
off_from_oct, size_from_oct, time_from_oct, uid_from_oct):
Cast limit to uintmax_t, for
benefit of pre-ANSI compilers with long long.
Paul Eggert [Fri, 31 Oct 1997 00:58:55 +0000 (00:58 +0000)]
(to_oct): Now static. Value arg is now uintmax_t. Accept new args
giving name of type of octal field, for error messages. Report an
error if the value is too large to fit in the field.
(gid_to_oct, major_to_oct, minor_to_oct, mode_to_oct, off_to_oct,
size_to_oct, time_to_oct, uid_to_oct, uintmax_to_oct): New functions.
(write_eot, write_long, finish_header, deal_with_sparse,
finish_sparse_file, dump_file): Use dev_t, off_t, ssize_t, size_t when
appropriate. Remove now-useless casts. Use unsigned long to print
*_t types, except use STRINGIFY_BIGINT for off_t.
(find_new_file_size): 1st arg is now off_t*.
(finish_sparse_file): Args now use off_t, not long.
Check for lseek error.
(create_archive, dump_file): Cast -1 to dev_t when necessary.
(dump_file): Device arg is now dev_t.
Avoid overflow when testing whether file has holes
by using the new ST_NBLOCKSIZE macro.
Paul Eggert [Fri, 31 Oct 1997 00:58:55 +0000 (00:58 +0000)]
(record_start_block, save_totsize, save_sizeleft, real_s_totsize,
real_s_sizeleft, current_block_ordinal): Now off_t.
(write_error): Arg is now ssize_t.
(child_pid): Now pid_t.
(available_space_after): Now size_t.
(child_open_for_compress, child_open_for_uncompress, flush_write,
open_archive, flush_write, write_error, flush_read, close_archive):
Use pid_t, ssize_t, size_t when appropriate. Remove now-useless
casts. Use unsigned long to print *_t types, except use
STRINGIFY_BIGINT for off_t.
Paul Eggert [Fri, 31 Oct 1997 00:58:55 +0000 (00:58 +0000)]
(read_and, list_archive, read_header, decode_mode, print_header,
print_for_mkdir): Use mode_t, off_t, size_t when appropriate. Remove
now-useless casts. Use unsigned long to print *_t types, except use
STRINGIFY_BIGINT for off_t.
(read_header): Check for overflow when converting header size.
(from_oct): Now static. Now returns uintmax_t. `where' arg is now
const char *. Size arg is now size_t. Now takes new type and maxval
args. Compute result using uintmax_t, not long. Report error if
field does not contain octal number in range.
(gid_from_oct, major_from_oct, minor_from_oct, mode_from_oct,
off_from_oct, size_from_oct, time_from_oct, uid_from_oct,
uintmax_from_oct): New functions.
(stringify_uintmax_t_backwards): New function.
(decode_mode, print_for_mkdir): Mode arg is now mode_t.
(skip_file): Offset arg is now off_t.
Paul Eggert [Fri, 31 Oct 1997 00:58:55 +0000 (00:58 +0000)]
(newdir_umask, current_umask): Now mode_t.
(extract_sparse_file): Args now use off_t.
(set_mode, set_stat, make_directories, extract_sparse_file,
extract_archive): Use off_t, size_t, ssize_t when appropriate. Remove
now-useless casts. Use unsigned long to print *_t types, except use
STRINGIFY_BIGINT for off_t.
Paul Eggert [Fri, 31 Oct 1997 00:58:55 +0000 (00:58 +0000)]
(do_command, rmt_open__, rmt_read__, rmt_lseek__, rmt_ioctl__): Use
pid_t, size_t, ssize_t when appropriate. Remove now-useless casts.
Use unsigned long to print *_t types, except use STRINGIFY_BIGINT for
off_t.
(get_status_string, get_status_off): New function.
(get_status): Now returns long, so that it can store ssize_t.
Invoke get_status_string to do the real work.
(rmt_read__, rmt_write__): Now returns ssize_t. Size arg is now size_t.
(rmt_lseek__): Now returns off_t, using new get_status_off function.
(rmt_ioctl__): Convert mt_count by hand, since it might be longer than long.
Paul Eggert [Fri, 31 Oct 1997 00:58:55 +0000 (00:58 +0000)]
(check_decimal): Now returns 1 if successful, 0 otherwise, and returns
uintmax_t value into new arg. Check for arithmetic overflow.
(decode_options): Avoid overflow if record_size fits in size_t but not int.
Check for overflow on user or group ids.
Paul Eggert [Fri, 31 Oct 1997 00:58:55 +0000 (00:58 +0000)]
(append_file) Use off_t, size_t, ssize_t when appropriate. Remove
now-useless casts. Use unsigned long to print *_t types, except use
STRINGIFY_BIGINT for off_t.
(update_archive): Cast -1 to dev_t when necessary.
Paul Eggert [Fri, 31 Oct 1997 00:58:55 +0000 (00:58 +0000)]
(allocated_size): Now size_t, and now initialized to 0.
(prepare_record_buffer): Arg is now size_t.
Remove now-useless casts.
(main): Use `long' for status, so that it can store ssize_t.
Use daddr_t, mode_t, size_t, off_t when appropriate.
Convert daddr_t and off_t values ourselves, since they might be longer
than long. Convert other types using `long' primitives.
When processing MTIOCTOP, do not try to pass resulting
count back, since it won't work (it could be too large) and it's
not expected anyway.