Paul Eggert [Wed, 11 Aug 1999 12:47:01 +0000 (12:47 +0000)]
(base_64_digits): New constant.
(base_8_digits): New macro.
(MAX_VAL_WITH_DIGITS): New macro.
(to_base): Renamed from to_oct. Support base 64 too.
New parameters specifying bits per digit and digits.
Remove `type' parameter. The result is now undefined if it doesn't fit;
it's the caller's responsibility to check this.
(to_chars): Other half of old to_oct, for 64-bit support.
Mostly a new function.
(GID_NOBODY, UID_NOBODY): Don't define if the headers don't.
(gid_substitute, uid_substitute): Look up names dynamically if
GID_NOBODY and UID_NOBODY aren't defined; use -2 if all else fails.
(mode_to_chars): Renamed from mode_to_oct.
Support negative values in all the _to_chars functions.
(start_header): Use FILESYSTEM_PREFIX_LEN instead of MSDOS ifdef.
Abort if archive format is DEFAULT_FORMAT when it shouldn't be.
(dump_file): Inspect entire pathname, not just new file name
component, when deciding whether to exclude it.
Paul Eggert [Wed, 11 Aug 1999 12:47:01 +0000 (12:47 +0000)]
(_GNU_SOURCE): Define.
(<fnmatch.h>): Include unconditionally.
(excluded_name): New function, taking over duties of excluded_pathname.
All uses changed.
Paul Eggert [Wed, 11 Aug 1999 12:47:01 +0000 (12:47 +0000)]
(_GNU_SOURCE): Define.
(<fnmatch.h>): Include unconditionally.
(child_open_for_compress): Dup after closing, to avoid possible file
descriptor exhaustion.
(flush_write): Use FILESYSTEM_PREFIX_LEN instead of MSDOS ifdef.
(flush_read): Likewise.
Paul Eggert [Wed, 11 Aug 1999 12:47:01 +0000 (12:47 +0000)]
(<fnmatch.h>): Do not include.
(from_chars): Renamed from from_oct. New parameter specifing
the negative of the minimum allowed value. Support negative
and base-64 values.
(base64_map): New var.
(base64_init): New function.
(print_header): Output numeric uids and gids if numeric_owner_option.
Paul Eggert [Tue, 20 Jul 1999 07:09:27 +0000 (07:09 +0000)]
this matches historical practice.
(unlink_destination): New function, which checks for unlink failures.
(maybe_recoverable): Stay quiet if -U.
(extract_archive): Use O_EXCL if unlink_first_option.
Report unlink failures.
Use HAVE_SYMLINK, not S_ISLNK, to determine whether symlink exists.
Use HAVE_MKFIFO || defined mkfifo, not S_ISFIFO, to determine whether
mkfifo exists.
Paul Eggert [Sat, 17 Jul 1999 01:49:35 +0000 (01:49 +0000)]
(total_written): Remove; replaced with prev_written + bytes_written.
(prev_written): New var.
(init_total_written): New function.
(print_total_written): Use TARLONG_FORMAT instead of print_tarlong.
Paul Eggert [Sat, 17 Jul 1999 01:49:35 +0000 (01:49 +0000)]
(decode_options): Set newer_time_option to TYPE_MINIMUM, so that
negative timestamps are handled correctly.
Replace invocations of xstrtol and xstrtoul with xstrtoumax, for
uniformity (and so that we don't need to have the other fns).
(main): Remove call to init_total_written; no longer needed.
Paul Eggert [Mon, 12 Jul 1999 13:03:58 +0000 (13:03 +0000)]
(start_header): Do not assume S_IFMT is defined.
(dump_file): Remove unnecessary check for screwy apollo lossage.
Do not assume S_IFBLK and S_IFCHR are defined.
Paul Eggert [Mon, 12 Jul 1999 13:03:58 +0000 (13:03 +0000)]
(is_regular_file): Don't succeed on files that we can't access due to
permissions problems.
(open_archive): Fix wording on fatal error message.
Don't bother to stat /dev/null if the archive is not a character
special device.
Paul Eggert [Thu, 8 Jul 1999 03:45:21 +0000 (03:45 +0000)]
(read_and): Use excluded_filename instead of check_exclude.
Check base name of incoming file name, not entire file name, when
deciding whether to exclude it.
Paul Eggert [Sat, 3 Jul 1999 00:00:19 +0000 (00:00 +0000)]
Include signal.h.
(SIGCHLD): Define to SIGCLD if SIGCLD is defined but SIGCHLD is not.
(main): Ensure SIGCHLD is not ignored, so that we can fork and wait.
Paul Eggert [Fri, 2 Jul 1999 21:33:51 +0000 (21:33 +0000)]
(BACKUP_OPTION, DELETE_OPTION, EXCLUDE_OPTION, GROUP_OPTION,
MODE_OPTION, NEWER_MTIME_OPTION, NO_RECURSE_OPTION, NULL_OPTION,
OWNER_OPTION, POSIX_OPTION, PRESERVE_OPTION, RECORD_SIZE_OPTION,
RSH_COMMAND_OPTION, SUFFIX_OPTION, USE_COMPRESS_PROGRAM_OPTION,
VOLNO_FILE_OPTION, OBSOLETE_ABSOLUTE_NAMES, OBSOLETE_BLOCK_COMPRESS,
OBSOLETE_BLOCKING_FACTOR, OBSOLETE_BLOCK_NUMBER,
OBSOLETE_READ_FULL_RECORDS, OBSOLETE_TOUCH, OBSOLETE_VERSION_CONTROL):
Make sure they can't be valid chars, so they don't overlap with char codes.
Use an enum instead of a lot of #defines.
(long_options, main, usage): Remove --ending-file option.
(OPTION_STRING): Remove -E.
Paul Eggert [Fri, 2 Jul 1999 21:25:09 +0000 (21:25 +0000)]
Don't include <ctype.h>; system.h already does this.
(ISODIGIT, ISSPACE): Remove; now in system.h.
(read_and): Excise ending_file_option.
(decode_header): No need to AND mode with 07777; MODE_FROM_OCT
does this now.
(from_oct): Cast ISSPACE arg to unsigned char.
(mode_from_oct): Translate modes from external to internal form.
Do not complain about unrecognized mode bits.
(decode_mode): Do not assume mode bits have traditional Unix values.
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).