diff options
author | Yann Collet <cyan@fb.com> | 2016-12-07 22:29:22 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2016-12-07 22:29:22 (GMT) |
commit | 01ffed25adbb4d18e48ceac59b1e5174ae29fc7f (patch) | |
tree | 4b757ce5132e80cc7741ac65d365a47e9c1cb862 /programs | |
parent | 5eb547a6080b8e63b5e522b448e31052fbc6b927 (diff) | |
download | lz4-01ffed25adbb4d18e48ceac59b1e5174ae29fc7f.zip lz4-01ffed25adbb4d18e48ceac59b1e5174ae29fc7f.tar.gz lz4-01ffed25adbb4d18e48ceac59b1e5174ae29fc7f.tar.bz2 |
fix : invocation of path/to/unlz4 (#284), reported by @beiDei8z
Diffstat (limited to 'programs')
-rw-r--r-- | programs/Makefile | 21 | ||||
-rw-r--r-- | programs/lz4cli.c | 9 |
2 files changed, 20 insertions, 10 deletions
diff --git a/programs/Makefile b/programs/Makefile index ffbcbf1..84662c2 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 @echo Cleaning completed @@ -112,13 +112,16 @@ preview-man: clean-man man #FreeBSD targets ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD)) +unlz4: lz4 + ln -s lz4 unlz4 + 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 +130,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..eda2018 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) name = path-1; + 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; |