Paul Eggert [Sat, 5 Jul 2003 07:17:20 +0000 (07:17 +0000)]
(namelist_match): Allow partial matches only if recursive.
(hash_string_hasher): Renamed from hash_avoided_name.
(hash_string_compare): Renamed from compare_avoided_anames.
(hash_string_insert, hash_string_lookup): New functions.
(add_avoided_name, is_avoided_name): Use them.
(safer_name_suffix): New function.
(contains_dot_dot): Moved here from misc.c. Now returns bool, not int.
Paul Eggert [Sat, 5 Jul 2003 07:00:54 +0000 (07:00 +0000)]
(read_and): Give full type for procedure arg.
(read_header): Strip trailing slashes, setting current_trailing_slash.
(tartime): Avoid int overflow when printing year (!).
(print_header): New arg specifing block ordinal. All uses changed.
Print link as 'h' type. Give labels for long links and names.
Paul Eggert [Sat, 5 Jul 2003 06:53:31 +0000 (06:53 +0000)]
(we_are_root): Now bool, not int.
(check_time): Warn about implausibly old time stamps.
(set_stat): Use utimbuf, not stat_info.
(preprare_to_extract): New arg DIRECTORY.
(fill_in_sparse_array): Moved here from compare.c.
(extract_sparse_file): Now returns off_t, giving size left.
Truncate file at end.
(extract_archive): Use safer_name_suffix rather than rolling our own.
Use fill_in_sparse_array rather than rolling our own.
Strip trailing slashes more effectively.
Check for unsafe names.
Paul Eggert [Sat, 5 Jul 2003 06:43:30 +0000 (06:43 +0000)]
(relativize): Remove; replaced by safer_name_suffix.
All callers changed.
(start_header): Clear devmajor and devminor fields, too.
(finish_header): New arg block_ordinal.
(init_sparsearray): Now extern. Set sp_array_size to
SPARSES_IN_OLDGNU_HEADER if it is zero.
(dump_file): Keep link table as a hash.
Do not count "file changed as we read it" as a failure.
Paul Eggert [Sat, 5 Jul 2003 06:19:54 +0000 (06:19 +0000)]
(print_total_written): Adjust to new human.h interface.
(child_open_for_compress): Do not increase size to BLOCKSIZE.
(open_archive): Open index file name.
Strip trailng slahes from file names.
(flush_write): Set size to 0 if not saving names.
(flush_write, flush_read): Use safer_name_suffix rather than
inline code.
Paul Eggert [Fri, 28 Sep 2001 06:54:20 +0000 (06:54 +0000)]
(strtol): Do not declare if HAVE_DECL_STRTOL.
(strtoul): Do not declare if HAVE_DECL_STRTOUL.
(strtoimax, strtoumax): Do not declare if already defined as a macro.
Paul Eggert [Wed, 26 Sep 2001 20:15:52 +0000 (20:15 +0000)]
(read_header): Don't keep around extended name and link info
indefinitely; keep it only for the next file. This fixes a bug
introduced in 1.13.24, and remove the need for some static variables.
Set recent_long_name and recent_long_link to zero if there were no
long links; this avoids a violation of ANSI C rules for pointers in
delete.c.
Paul Eggert [Tue, 25 Sep 2001 18:17:36 +0000 (18:17 +0000)]
(EILSEQ): Include <time.h> and <wchar.h> if <errno.h> does not define
EILSEQ, because BSD/OS 4.1 defines EILSEQ in <wchar.h>, which requires
<time.h>. Define a replacement EILSEQ to be ENOENT, not EINVAL, since
callers may want to distinguish EINVAL and EILSEQ.
Paul Eggert [Sat, 22 Sep 2001 00:47:09 +0000 (00:47 +0000)]
Include print-copyr.h, not copysym.h.
(decode_options): Use print_copyright, not copyright_symbol.
(OVERWRITE_DIR_OPTION): New constant.
(long_options, usage, decode_options): Add --overwrite-dir.
Paul Eggert [Sat, 22 Sep 2001 00:47:09 +0000 (00:47 +0000)]
(records_read, records_written): New vars.
(write_archive_to_stdout): Now bool, not int.
(open_archive, flush_write, flush_read): Keep records_read and
records_written up to date.
Paul Eggert [Sat, 22 Sep 2001 00:47:09 +0000 (00:47 +0000)]
(recent_long_name, recent_long_link, recent_long_name_blocks,
recent_long_link_blocks): New vars.
(read_and): Pass 0 to read_header.
(read_header): New arg RAW_EXTENDED_HEADERS. Store away extended headers
into new vars. Null-terminate incoming symbolic links.
Paul Eggert [Sat, 22 Sep 2001 00:47:09 +0000 (00:47 +0000)]
(extract_archive): When marking a directory to be updated after
symlinks, stat all directories after it in the delayed-set-stat
list too, since they will be checked after symlinks.
Add support for --overwrite-dir.
Paul Eggert [Fri, 21 Sep 2001 22:26:45 +0000 (22:26 +0000)]
(unicode_to_mb): Return int, not void. New arg for failure callback.
(print_unicode_success, print_unicode_failure): New decls.
(print_unicode_char): Return int, not void.
Paul Eggert [Fri, 21 Sep 2001 22:26:45 +0000 (22:26 +0000)]
(EILSEQ, ENOTSUP): New macros, if not defined by errno.h.
(<error.h>): Do not include.
(unicode_to_mb): Return int, not void. New arg for failure callback.
Invoke the failure callback instead of invoking 'error'.
(print_unicode_success): Renamed from fprintf_callback. Now extern.
Return -1 on failure, 0 on success.
(print_unicode_failure): New function.
(print_unicode_char): Return int. Adjust to changes to unicode_to_mb.
Do not report error: instead, print an approximation.
Paul Eggert [Thu, 20 Sep 2001 18:01:31 +0000 (18:01 +0000)]
From Jim Meyering.
(strtoimax): Guard declaration with
`#if !HAVE_DECL_STRTOIMAX', rather than just `#ifndef strtoimax'.
The latter fails because some systems (at least rs6000-ibm-aix4.3.3.0)
have their own, conflicting declaration of strtoimax in sys/inttypes.h.
(strtoumax): Likewise, for completeness (it wasn't necessary).
Paul Eggert [Sat, 15 Sep 2001 06:11:37 +0000 (06:11 +0000)]
Include stddef.h, for size_t.
Include langinfo.h if needed.
Use locale_charset only if USE_INCLUDED_LIBINTL;
if not, use nl_langinfo (CODESET) if available.
Paul Eggert [Wed, 12 Sep 2001 06:46:23 +0000 (06:46 +0000)]
(struct delayed_set_stat): New member 'after_symlinks'.
(delay_set_stat): Initialize it to 0.
(set_mode): New arg current_stat_info. Use it (if nonnull) to avoid
taking an extra stat ourselves. All callers changed.
(set_stat): Likewise.
(apply_nonancestor_delayed_set_stat): New arg 'after_symlinks'.
If false, stop when encountering a struct whose 'after_symlinks' member is
true. Otherwise, go through all structures but check them more carefully.
All callers changed.
(extract_archive): When extracting a deferred symlink, if its parent
directory's status needs fixing, then mark the directory as needing
to be fixed after symlinks.
(extract_finish): Fix status of ordinary directories, then apply delayed
symlinks, then fix the status of directories that are ancestors
of delayed symlinks.
Paul Eggert [Thu, 6 Sep 2001 19:47:45 +0000 (19:47 +0000)]
(HAVE_LONG_LONG): Redefine to HAVE_UNSIGNED_LONG_LONG if unsigned.
(strtoimax): Use sizeof (long), not sizeof strtol (ptr, endptr, base),
to work around bug in IBM C compiler.
Paul Eggert [Wed, 29 Aug 2001 21:37:27 +0000 (21:37 +0000)]
(name_gather, addname): Use offsetof when computing sizes for
struct hack; this avoids wasted space in some cases.
(name_gather): Use strcpy, not memcpy.
for consistency with other code that does similar things.
(read_name_from_file, name_next, name_gather, add_hierarchy_to_namelist):
Avoid quadratic behavior when reallocating buffers.
Check for buffer size overflow.
(addname): Avoid unnecessary clearing of memory.
Paul Eggert [Wed, 29 Aug 2001 21:37:27 +0000 (21:37 +0000)]
(dump_file): Relativize link names before dumping.
This fixes a bug reported by Jose Pedro Oliveira.
(dump_file): Use offsetof when computing sizes for
struct hack; this avoids wasted space in some cases.
Paul Eggert [Wed, 29 Aug 2001 21:37:27 +0000 (21:37 +0000)]
(delay_set_stat): Fix off-by-one error in file
name size allocation that caused core dumps.
From Jan.Djarv@mbox200.swipnet.se.
(extract_archive): Use strcpy, not memcpy,
for consistency with other code that does similar things.
Paul Eggert [Wed, 29 Aug 2001 06:36:20 +0000 (06:36 +0000)]
Fix copyright notice.
(UNSIGNED): Renamed from STRTOUXMAX_UNSIGNED.
(verify): New macro.
(INT): Renamed from uintmax_t.
(strtoumax, strtoull, strtoul): Remove.
(strtoimax, strtol, strtoll): New macros.
(strtoimax): Renamed from strtoumax. Interchange signed with unsigned.
Verify sizes at compile-time, not at run-time.
Prefer strtol to strtoll if both work.
(main): Remove.
Paul Eggert [Wed, 29 Aug 2001 06:36:20 +0000 (06:36 +0000)]
(jm_AC_PREREQ_XSTRTOUMAX): Quote first arg of AC_DEFUN.
Require jm_AC_TYPE_INTMAX_T and jm_AC_TYPE_LONG_LONG since they
is needed to parse the include file.
Simplify logic behind the args to AC_REPLACE.
Paul Eggert [Wed, 29 Aug 2001 06:36:20 +0000 (06:36 +0000)]
(jm_AC_PREREQ_XSTRTOIMAX):
Require jm_AC_TYPE_UINTMAX_T and jm_AC_TYPE_UNSIGNED_LONG_LONG since they
are needed to parse the include file.
Do not require jm_AC_HEADER_INTTYPES_H; it's obsolete.
Check for inttypes.h.
Simplify logic behind the args to AC_REPLACE.
Paul Eggert [Wed, 29 Aug 2001 06:36:20 +0000 (06:36 +0000)]
(jm_AC_HEADER_INTTYPES_H): Remove; now done by autoconf.
(jm_AC_TYPE_INTMAX_T, jm_AC_TYPE_UINTMAX_T): Replace with
Use AC_CHECK_TYPE instead of merely looking for the header.