CHECK_FUNCTION_EXISTS_GLIBC(strchr HAVE_STRCHR)
CHECK_FUNCTION_EXISTS_GLIBC(strdup HAVE_STRDUP)
CHECK_FUNCTION_EXISTS_GLIBC(strerror HAVE_STRERROR)
+CHECK_FUNCTION_EXISTS_GLIBC(strncpy_s HAVE_STRNCPY_S)
CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR)
CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK)
CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM)
if BUILD_BSDTAR
bsdtar_test_programs= bsdtar_test
-bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test
+bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar$(EXEEXT) BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test
else
bsdtar_test_programs=
bsdtar_TESTS_ENVIRONMENT=
if BUILD_BSDCPIO
bsdcpio_test_programs= bsdcpio_test
-bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test
+bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio$(EXEEXT) BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test
else
bsdcpio_test_programs=
bsdcpio_TESTS_ENVIRONMENT=
AC_CHECK_FUNCS([lchflags lchmod lchown link lstat])
AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod])
AC_CHECK_FUNCS([nl_langinfo pipe poll readlink select setenv setlocale])
-AC_CHECK_FUNCS([strchr strdup strerror strrchr symlink timegm])
+AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm])
AC_CHECK_FUNCS([tzset unsetenv utime utimes vfork])
AC_CHECK_FUNCS([wcrtomb wcscpy wcslen wctomb wmemcmp wmemcpy])
# detects cygwin-1.7, as opposed to older versions
* and format string here must be compatible with one another and
* large enough for any file.
*/
-#if HAVE_UINTMAX_T
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define CPIO_FILESIZE_TYPE __int64
+#define CPIO_FILESIZE_PRINTF "%I64u"
+#elif HAVE_UINTMAX_T
#define CPIO_FILESIZE_TYPE uintmax_t
#define CPIO_FILESIZE_PRINTF "%ju"
-#else
-#if HAVE_UNSIGNED_LONG_LONG
+#elif HAVE_UNSIGNED_LONG_LONG
#define CPIO_FILESIZE_TYPE unsigned long long
#define CPIO_FILESIZE_PRINTF "%llu"
#else
#define CPIO_FILESIZE_TYPE unsigned long
#define CPIO_FILESIZE_PRINTF "%lu"
#endif
-#endif
+
/* How to mark functions that don't return. */
#if defined(__GNUC__) && (__GNUC__ > 2 || \
struct tree {
struct tree_entry *stack;
struct tree_entry *current;
-#ifdef HAVE_WINDOWS_H
+#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__)
HANDLE d;
#define INVALID_DIR_HANDLE INVALID_HANDLE_VALUE
WIN32_FIND_DATA _findData;
*p++ = DIRSEP;
t->path_length ++;
}
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if HAVE_STRNCPY_S
strncpy_s(p, t->buff_length - (p - t->buff), name, name_length);
#else
strncpy(p, name, name_length);
int
tree_current_is_dir(struct tree *t)
{
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__CYGWIN__)
if (t->findData)
return (t->findData->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
if (tree_current_file_information(t))
int
tree_current_is_physical_dir(struct tree *t)
{
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__CYGWIN__)
if (tree_current_is_physical_link(t))
return (0);
return (tree_current_is_dir(t));
int
tree_current_is_physical_link(struct tree *t)
{
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__CYGWIN__)
if (t->findData)
return ((t->findData->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
&& (t->findData->dwReserved0 == IO_REPARSE_TAG_SYMLINK));