diff options
author | Przemyslaw Skibinski <inikep@gmail.com> | 2016-12-08 14:22:02 (GMT) |
---|---|---|
committer | Przemyslaw Skibinski <inikep@gmail.com> | 2016-12-08 14:22:02 (GMT) |
commit | 20183ad7af4497fa1c59c56d8459ef6bfc6c41c5 (patch) | |
tree | 6a5cf4741fee3e0eb9f7c2e39ec0fa4cab33ca7f | |
parent | 8c2f23c130c0613dfd243d539f733bc3e44a2a70 (diff) | |
parent | 0280cf40dd01caa784d291480aaead9987ae9f9a (diff) | |
download | lz4-20183ad7af4497fa1c59c56d8459ef6bfc6c41c5.zip lz4-20183ad7af4497fa1c59c56d8459ef6bfc6c41c5.tar.gz lz4-20183ad7af4497fa1c59c56d8459ef6bfc6c41c5.tar.bz2 |
Merge remote-tracking branch 'refs/remotes/lz4/dev' into dev
-rw-r--r-- | programs/.gitignore | 2 | ||||
-rw-r--r-- | programs/Makefile | 24 | ||||
-rw-r--r-- | programs/lz4cli.c | 10 | ||||
-rw-r--r-- | tests/Makefile | 25 |
4 files changed, 48 insertions, 13 deletions
diff --git a/programs/.gitignore b/programs/.gitignore index df3423e..daa7f14 100644 --- a/programs/.gitignore +++ b/programs/.gitignore @@ -1,5 +1,7 @@ # local binary (Makefile) lz4 +unlz4 +lz4cat lz4c lz4c32 datagen diff --git a/programs/Makefile b/programs/Makefile index ffbcbf1..74a2440 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -91,7 +91,7 @@ lz4c32: lz4 clean: @$(MAKE) -C $(LZ4DIR) $@ > $(VOID) @$(RM) core *.o *.test tmp* \ - lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) + lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) unlz4 lz4cat @echo Cleaning completed @@ -112,13 +112,19 @@ preview-man: clean-man man #FreeBSD targets ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD)) +unlz4: lz4 + ln -s lz4 unlz4 + +lz4cat: lz4 + ln -s lz4 lz4cat + install: lz4$(EXT) lz4c$(EXT) @echo Installing binaries @install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/ - @install -m 755 lz4$(EXT) $(DESTDIR)$(BINDIR)/lz4$(EXT) - @ln -sf lz4$(EXT) $(DESTDIR)$(BINDIR)/lz4cat$(EXT) - @ln -sf lz4$(EXT) $(DESTDIR)$(BINDIR)/unlz4$(EXT) - @install -m 755 lz4c$(EXT) $(DESTDIR)$(BINDIR)/lz4c$(EXT) + @install -m 755 lz4 $(DESTDIR)$(BINDIR)/lz4 + @ln -sf lz4 $(DESTDIR)$(BINDIR)/lz4cat + @ln -sf lz4 $(DESTDIR)$(BINDIR)/unlz4 + @install -m 755 lz4c$(EXT) $(DESTDIR)$(BINDIR)/lz4c @echo Installing man pages @install -m 644 lz4.1 $(DESTDIR)$(MANDIR)/lz4.1 @ln -sf lz4.1 $(DESTDIR)$(MANDIR)/lz4c.1 @@ -127,10 +133,10 @@ install: lz4$(EXT) lz4c$(EXT) @echo lz4 installation completed uninstall: - @$(RM) $(DESTDIR)$(BINDIR)/lz4cat$(EXT) - @$(RM) $(DESTDIR)$(BINDIR)/unlz4$(EXT) - @$(RM) $(DESTDIR)$(BINDIR)/lz4$(EXT) - @$(RM) $(DESTDIR)$(BINDIR)/lz4c$(EXT) + @$(RM) $(DESTDIR)$(BINDIR)/lz4cat + @$(RM) $(DESTDIR)$(BINDIR)/unlz4 + @$(RM) $(DESTDIR)$(BINDIR)/lz4 + @$(RM) $(DESTDIR)$(BINDIR)/lz4c @$(RM) $(DESTDIR)$(MANDIR)/lz4.1 @$(RM) $(DESTDIR)$(MANDIR)/lz4c.1 @$(RM) $(DESTDIR)$(MANDIR)/lz4cat.1 diff --git a/programs/lz4cli.c b/programs/lz4cli.c index 46c2f1b..b63d69d 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -260,6 +260,13 @@ static void waitEnter(void) (void)getchar(); } +static const char* lastNameFromPath(const char* path) +{ + const char* name = strrchr(path, '/'); + if (name==NULL) name = strrchr(path, '\\'); /* windows */ + if (name==NULL) return path; + return name+1; +} /*! readU32FromChar() : @return : unsigned integer value reach from input in `char` format @@ -294,7 +301,7 @@ int main(int argc, const char** argv) const char nullOutput[] = NULL_OUTPUT; const char extension[] = LZ4_EXTENSION; size_t blockSize = LZ4IO_setBlockSizeID(LZ4_BLOCKSIZEID_DEFAULT); - const char* const exeName = argv[0]; + const char* const exeName = lastNameFromPath(argv[0]); #ifdef UTIL_HAS_CREATEFILELIST const char** extendedFileList = NULL; char* fileNamesBuf = NULL; @@ -312,6 +319,7 @@ int main(int argc, const char** argv) if (!strcmp(exeName, LZ4CAT)) { mode = om_decompress; LZ4IO_setOverwrite(1); + LZ4IO_setRemoveSrcFile(0); forceStdout=1; output_filename=stdoutmark; displayLevel=1; diff --git a/tests/Makefile b/tests/Makefile index e58d449..eb36abf 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -38,7 +38,7 @@ VOID := /dev/null TESTDIR := versionsTest PYTHON ?= python3 -CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make +CFLAGS ?= -O3 # can select custom optimization flags. For example : CFLAGS=-O2 make CFLAGS += -g -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \ -Wdeclaration-after-statement -Wstrict-prototypes \ -Wpointer-arith -Wstrict-aliasing=1 @@ -206,12 +206,18 @@ test-lz4-multiple: lz4 datagen $(LZ4) -f -m tmp1 notHere tmp2; echo $$? @$(RM) tmp* -test-lz4-basic: lz4 datagen +unlz4: + @$(MAKE) -C $(PRGDIR) $@ CFLAGS="$(CFLAGS)" + +lz4cat: + @$(MAKE) -C $(PRGDIR) $@ CFLAGS="$(CFLAGS)" + +test-lz4-basic: lz4 datagen unlz4 lz4cat @echo "\n ---- test lz4 basic compression/decompression ----" ./datagen -g0 | $(LZ4) -v | $(LZ4) -t ./datagen -g16KB | $(LZ4) -9 | $(LZ4) -t ./datagen -g20KB > tmpSrc - $(LZ4) < tmpSrc | $(LZ4) -d > tmpRes + $(LZ4) < tmpSrc | $(LZ4) -d > tmpRes diff -q tmpSrc tmpRes $(LZ4) --no-frame-crc < tmpSrc | $(LZ4) -d > tmpRes diff -q tmpSrc tmpRes @@ -220,6 +226,19 @@ test-lz4-basic: lz4 datagen ./datagen -g17M | $(LZ4) -9v | $(LZ4) -qt ./datagen -g33M | $(LZ4) --no-frame-crc | $(LZ4) -t ./datagen -g256MB | $(LZ4) -vqB4D | $(LZ4) -t + @echo "hello world" > tmp + $(LZ4) --rm -f tmp + ls -ls tmp && false || true # must fail (--rm) + ls -ls tmp.lz4 + $(PRGDIR)/lz4cat tmp.lz4 # must display hello world + ls -ls tmp.lz4 + $(PRGDIR)/unlz4 --rm tmp.lz4 + ls -ls tmp + ls -ls tmp.lz4 && false || true # must fail (--rm) + ls -ls tmp.lz4.lz4 && false || true # must fail (unlz4) + $(PRGDIR)/lz4cat tmp # pass-through mode + ls -ls tmp + ls -ls tmp.lz4 && false || true # must fail (lz4cat) @$(RM) tmp* test-lz4-hugefile: lz4 datagen |