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.
Paul Eggert [Wed, 29 Aug 2001 06:36:20 +0000 (06:36 +0000)]
("pathmax.h"): Do not include; no longer needed.
(<stdlib.h>, <unistd.h>): Include if available.
("xalloc.h"): Include.
(xmalloc, xstrdup, free): Remove decls; no longer needed.
(xgetcwd): Don't assume sizes fit in 'unsigned'.
Check for overflow when path size gets too large.
Simplify failure code.
Paul Eggert [Mon, 27 Aug 2001 14:32:51 +0000 (14:32 +0000)]
(from_header): Do not issue a diagnostic if TYPE is zero.
However, check for error even for '-' or '+' case.
(print_header): Try parsing uids and gids as unsigned integers first,
and as a uid_t or gid_t only if that fails. This adds support for
listing positive uids and gids that are greater than UID_MAX and
GID_MAX.
Paul Eggert [Mon, 27 Aug 2001 14:27:54 +0000 (14:27 +0000)]
(struct delayed_symlinks, extract_archive, apply_delayed_symlinks):
Support hard links to symbolic links.
(struct delayed_symlink): Remove 'names' member, replacing it with
'sources' and 'target' member. All uses changed.
(struct string_list): New type.
(delayed_set_stat, extract_archive): Use offsetof when computing sizes
for struct hack; this avoids wasted space in some cases.
(extract_archive): Fix test for absolute pathnames and/or "..".
Use link_error to report errors for links.
Remove redundant trailing '/' at "really_dir", for all uses, not
just before invoking mkdir.
If overwriting old files, do not worry so much about existing directories.
Fix mode computation in the case where the directory exists.
(apply_delayed_symlinks): If we can't make a hard link to a symbolic
link, make a copy of the symbolic link.
Paul Eggert [Mon, 27 Aug 2001 00:02:27 +0000 (00:02 +0000)]
Put leading '*' in direntry.
Accommodate new gfdl sectioning.
New option --recursion (the default) that is the inverse of --no-recursion.
New options --anchored, --ignore-case, --wildcards,
--wildcards-match-slash, and their negations (e.g., --no-anchored).
Along with --recursion and --no-recursion, these control how exclude
patterns are interpreted. The default interpretation of exclude
patterns is now --no-anchored --no-ignore-case --recursion
--wildcards --wildcards-match-slash.