summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2016-04-01 14:41:58 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2016-04-01 14:41:58 (GMT)
commit220e0b606a0f4b51d9df6e8b5b4496b9ba1280d1 (patch)
treee2bed7b09b33f71424566a2a0b585e2ad39c5057
parent60ba8638cdd255eef787a222374bb8b11779e970 (diff)
parentcf6652f9b91593b5d48588e4ed8105669375f110 (diff)
downloadlz4-220e0b606a0f4b51d9df6e8b5b4496b9ba1280d1.zip
lz4-220e0b606a0f4b51d9df6e8b5b4496b9ba1280d1.tar.gz
lz4-220e0b606a0f4b51d9df6e8b5b4496b9ba1280d1.tar.bz2
Merge pull request #194 from jzhuge/dev
lz4cli: print library version
-rw-r--r--lib/lz4.c1
-rw-r--r--lib/lz4.h7
-rw-r--r--programs/lz4cli.c7
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 8512452..39bf5d6 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -414,6 +414,7 @@ typedef enum { full = 0, partial = 1 } earlyEnd_directive;
* Local Utils
**************************************/
int LZ4_versionNumber (void) { return LZ4_VERSION_NUMBER; }
+const char* LZ4_versionString (void) { return LZ4_VERSION_STRING; }
int LZ4_compressBound(int isize) { return LZ4_COMPRESSBOUND(isize); }
int LZ4_sizeofState() { return LZ4_STREAMSIZE; }
diff --git a/lib/lz4.h b/lib/lz4.h
index 96e25a6..ff5a571 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -50,9 +50,16 @@ extern "C" {
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
#define LZ4_VERSION_MINOR 7 /* for new (non-breaking) interface capabilities */
#define LZ4_VERSION_RELEASE 2 /* for tweaks, bug-fixes, or development */
+
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
int LZ4_versionNumber (void);
+#define LZ4_STR(str) #str
+#define LZ4_XSTR(str) LZ4_STR(str)
+#define LZ4_VERSION_STRING LZ4_XSTR(LZ4_VERSION_MAJOR) "." \
+ LZ4_XSTR(LZ4_VERSION_MINOR) "." LZ4_XSTR(LZ4_VERSION_RELEASE)
+const char* LZ4_versionString (void);
+
/**************************************
* Tuning parameter
**************************************/
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 505191b..2d491df 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -59,6 +59,7 @@
#include <stdlib.h> /* exit, calloc, free */
#include <string.h> /* strcmp, strlen */
#include "bench.h" /* BMK_benchFile, BMK_SetNbIterations, BMK_SetBlocksize, BMK_SetPause */
+#include "lz4.h" /* LZ4_versionString */
#include "lz4io.h" /* LZ4IO_compressFilename, LZ4IO_decompressFilename, LZ4IO_compressMultipleFilenames */
@@ -85,12 +86,14 @@
/*****************************
* Constants
******************************/
-#define COMPRESSOR_NAME "LZ4 command line interface"
+#define COMPRESSOR_NAME "LZ4 CLI"
#ifndef LZ4_VERSION
# define LZ4_VERSION "r128"
#endif
#define AUTHOR "Yann Collet"
-#define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), LZ4_VERSION, AUTHOR, __DATE__
+#define WELCOME_MESSAGE "*** %s %i-bits %s (lib %s), by %s ***\n", \
+ COMPRESSOR_NAME, (int)(sizeof(void*)*8), LZ4_VERSION, \
+ LZ4_versionString(), AUTHOR
#define LZ4_EXTENSION ".lz4"
#define LZ4CAT "lz4cat"
#define UNLZ4 "unlz4"