+2006-12-12 Paul Eggert <eggert@cs.ucla.edu>
+
+ Port to Forte Developer 7 C 5.4 and C99.
+ * src/common.h (add_exclude_tag): Add decl; C99 requires this
+ and Forte warns about it.
+ * src/incremen.c: Include <mkdtemp.h> for mkdtemp prototype,
+ for same reason.
+ * src/misc.c (get_max_open_files): Rewrite to avoid code that
+ Forte C complains about as being unreachable.
+ * src/xheader.c (mtime_code): Rewrite to avoid Forte error
+ reported by Trond Hasle Amundsen.
+
+ * src/incremen.c (compare_dirnames): Rewrite to avoid casts.
+ * src/utf8.c (string_ascii_p): Likewise.
+ * src/xheader.c (mtime_coder, volume_size_coder, volume_offset_coder):
+ Likewise.
+
2006-12-08 Sergey Poznyakoff <gray@gnu.org.ua>
* bootstrap: Add paxutils files to dot_ignore.
Patch proposed by Jan-Benedict Glaw <jbglaw@lug-owl.de>
* tests/truncate.at: Use genfile instead of dd, because on some
systems /dev/zero is not available.
-
+
2006-12-04 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Fix some race conditions with tar -x --same-owner.
dump_status_not_implemented
};
+void add_exclude_tag (const char *name);
bool file_dumpable_p (struct tar_stat_info *st);
void create_archive (void);
void pad_archive (off_t size_left);
#include <system.h>
#include <getline.h>
#include <hash.h>
+#include <mkdtemp.h>
#include <quotearg.h>
#include "common.h"
static int
compare_dirnames (const void *first, const void *second)
{
- return strcmp (*(const char**)first, *(const char**)second);
+ char const *const *name1 = first;
+ char const *const *name2 = second;
+ return strcmp (*name1, *name2);
}
/* Compare dumpdir array from DIRECTORY with directory listing DIR and
/* Miscellaneous functions, not really specific to GNU tar.
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
if (getrlimit(RLIMIT_NOFILE, &rlim) == 0)
return rlim.rlim_max;
+ return -1;
#elif defined HAVE_GETDTABLESIZE
return getdtablesize ();
-#endif
+#else
return -1;
+#endif
}
/* Close all descriptors, except the first three */
for (i = get_max_open_files () - 1; i > 2; i--)
close (i);
}
-
+
/* Change to directory I. If I is 0, change to the initial working
directory; otherwise, I must be a value returned by chdir_arg. */
void
{
static int previous;
static int saved_count;
-
+
if (previous != i)
{
struct wd *prev = &wd[previous];
/* Charset handling for GNU tar.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
# define ICONV_CONST
#endif
-#ifndef HAVE_ICONV
+#ifndef HAVE_ICONV
# undef iconv_open
# define iconv_open(tocode, fromcode) ((iconv_t) -1)
# undef iconv_close
# define iconv_close(cd) 0
-#endif
+#endif
\f
\f
bool
-string_ascii_p (const char *str)
+string_ascii_p (char const *p)
{
- const unsigned char *p = (const unsigned char *)str;
for (; *p; p++)
- if (*p > 127)
+ if (! (0 <= *p && *p <= 127))
return false;
return true;
}
to the result of the basename
utility on the translated file name.
%p The process ID of the pax process.
- %n The value of the 3rd argument.
+ %n The value of the 3rd argument.
%% A '%' character. */
char *
}
free (dirp);
-
+
/* Do not allow it to end in a slash */
while (q > buf && ISSLASH (q[-1]))
q--;
ERROR ((0, 0, _("Extended header length is out of allowed range")));
return false;
}
-
+
if (len_max < len)
{
int len_len = len_lim - p;
return true;
}
-
+
static void
code_num (uintmax_t value, char const *keyword, struct xheader *xhdr)
mtime_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
- const struct timespec mtime = data ? *(struct timespec *) data : st->mtime;
- code_time (mtime, keyword, xhdr);
+ struct timespec const *mtime = data;
+ code_time (mtime ? *mtime : st->mtime, keyword, xhdr);
}
static void
volume_size_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
- off_t v = *(off_t*)data;
- code_num (v, keyword, xhdr);
+ off_t const *v = data;
+ code_num (*v, keyword, xhdr);
}
static void
volume_offset_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
- off_t v = *(off_t*)data;
- code_num (v, keyword, xhdr);
+ off_t const *v = data;
+ code_num (*v, keyword, xhdr);
}
static void
if (decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
st->sparse_major = u;
}
-
+
static void
sparse_minor_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data)
{
- code_num (st->sparse_minor, keyword, xhdr);
+ code_num (st->sparse_minor, keyword, xhdr);
}
static void
if (decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
st->sparse_minor = u;
}
-
+
struct xhdr_tab const xhdr_tab[] = {
{ "atime", atime_coder, atime_decoder, false },
{ "comment", dummy_coder, dummy_decoder, false },