{
fprintf(stdout,"bsdcpio %s -- %s\n",
BSDCPIO_VERSION_STRING,
- archive_version_string());
+ archive_version_details());
exit(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
/* Skip a single trailing a,b,c, or d. */
if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
++q;
+ /* Skip arbitrary third-party version numbers. */
+ while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) {
+ ++q;
+ --s;
+ }
/* All terminated by end-of-line: \r, \r\n, or \n */
assert(s >= 1);
failure("Version: %s", p);
#define ARCHIVE_VERSION_STRING "libarchive 3.1.2"
__LA_DECL const char * archive_version_string(void);
+/*
+ * Detailed textual name/version of the library and its dependencies.
+ */
+__LA_DECL const char * archive_version_details(void);
+
/* Declare our basic types. */
struct archive;
struct archive_entry;
#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
#include <wincrypt.h>
#endif
+#ifdef HAVE_ZLIB_H
+#include <zlib.h>
+#endif
+#ifdef HAVE_LZMA_H
+#include <lzma.h>
+#endif
+#ifdef HAVE_BZLIB_H
+#include <bzlib.h>
+#endif
#include "archive.h"
#include "archive_private.h"
return (ARCHIVE_VERSION_STRING);
}
+const char *
+archive_version_details(void)
+{
+ static char version[80];
+#ifdef HAVE_BZLIB_H
+ char *bzlib_version = strdup(BZ2_bzlibVersion());
+ char *ptr = strchr(bzlib_version, ',');
+ if (ptr)
+ *ptr = '\0';
+#endif
+ snprintf(version, sizeof(version), ARCHIVE_VERSION_STRING
+#ifdef HAVE_ZLIB_H
+ " zlib/" ZLIB_VERSION
+#endif
+#ifdef HAVE_LZMA_H
+ " liblzma/" LZMA_VERSION_STRING
+#endif
+#ifdef HAVE_BZLIB_H
+ " bz2lib/%s", bzlib_version
+#endif
+ );
+#ifdef HAVE_BZLIB_H
+ free(bzlib_version);
+#endif
+ return (version);
+}
+
int
archive_errno(struct archive *a)
{
#define LIBRARY "libarchive"
#define EXTRA_DUMP(x) archive_error_string((struct archive *)(x))
#define EXTRA_ERRNO(x) archive_errno((struct archive *)(x))
-#define EXTRA_VERSION archive_version_string()
+#define EXTRA_VERSION archive_version_details()
/*
*
{
printf("bsdtar %s - %s\n",
BSDTAR_VERSION_STRING,
- archive_version_string());
+ archive_version_details());
exit(0);
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
/* Skip a single trailing a,b,c, or d. */
if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
++q;
+ /* Skip arbitrary third-party version numbers. */
+ while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) {
+ ++q;
+ --s;
+ }
/* All terminated by end-of-line. */
assert(s >= 1);
/* Skip an optional CR character (e.g., Windows) */