summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorPrzemyslaw Skibinski <inikep@gmail.com>2016-12-08 14:22:02 (GMT)
committerPrzemyslaw Skibinski <inikep@gmail.com>2016-12-08 14:22:02 (GMT)
commit20183ad7af4497fa1c59c56d8459ef6bfc6c41c5 (patch)
tree6a5cf4741fee3e0eb9f7c2e39ec0fa4cab33ca7f /programs
parent8c2f23c130c0613dfd243d539f733bc3e44a2a70 (diff)
parent0280cf40dd01caa784d291480aaead9987ae9f9a (diff)
downloadlz4-20183ad7af4497fa1c59c56d8459ef6bfc6c41c5.zip
lz4-20183ad7af4497fa1c59c56d8459ef6bfc6c41c5.tar.gz
lz4-20183ad7af4497fa1c59c56d8459ef6bfc6c41c5.tar.bz2
Merge remote-tracking branch 'refs/remotes/lz4/dev' into dev
Diffstat (limited to 'programs')
-rw-r--r--programs/.gitignore2
-rw-r--r--programs/Makefile24
-rw-r--r--programs/lz4cli.c10
3 files changed, 26 insertions, 10 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;