fix : invocation of path/to/unlz4 (#284), reported by @beiDei8z

This commit is contained in:
Yann Collet 2016-12-07 14:29:22 -08:00
parent 5eb547a608
commit 01ffed25ad
3 changed files with 33 additions and 12 deletions

View File

@ -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

View File

@ -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;

View File

@ -206,7 +206,10 @@ test-lz4-multiple: lz4 datagen
$(LZ4) -f -m tmp1 notHere tmp2; echo $$?
@$(RM) tmp*
test-lz4-basic: lz4 datagen
unlz4:
@$(MAKE) -C $(PRGDIR) unlz4
test-lz4-basic: lz4 datagen unlz4
@echo "\n ---- test lz4 basic compression/decompression ----"
./datagen -g0 | $(LZ4) -v | $(LZ4) -t
./datagen -g16KB | $(LZ4) -9 | $(LZ4) -t
@ -220,6 +223,14 @@ 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 tmp
ls -ls tmp && false || true # must fail (--rm)
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)
@$(RM) tmp*
test-lz4-hugefile: lz4 datagen