Merge branch 'archive-version-details' of github.com:rosslagerwall/libarchive into rosslagerwall-archive-version-details
This commit is contained in:
commit
f111f77f79
9 files changed
+56
-3
No files matched your search
+1
-1
@@ -489,7 +489,7 @@ version(void)
|
||||
{
|
||||
fprintf(stdout,"bsdcpio %s -- %s\n",
|
||||
BSDCPIO_VERSION_STRING,
|
||||
archive_version_string());
|
||||
archive_version_details());
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -74,6 +74,11 @@ verify(const char *p, size_t s)
|
||||
/* 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);
|
||||
|
||||
@@ -133,6 +133,11 @@ __LA_DECL int archive_version_number(void);
|
||||
#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;
|
||||
|
||||
@@ -45,6 +45,15 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1
|
||||
#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"
|
||||
@@ -76,6 +85,33 @@ archive_version_string(void)
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/main.c 201247 2009-12-30 05:59:21Z
|
||||
#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()
|
||||
|
||||
/*
|
||||
*
|
||||
|
||||
+1
-1
@@ -846,7 +846,7 @@ version(void)
|
||||
{
|
||||
printf("bsdtar %s - %s\n",
|
||||
BSDTAR_VERSION_STRING,
|
||||
archive_version_string());
|
||||
archive_version_details());
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -87,6 +87,11 @@ DEFINE_TEST(test_version)
|
||||
/* 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) */
|
||||
|
||||
Reference in new issue
Block a user