summaryrefslogtreecommitdiffstats
path: root/programs/lz4cli.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2016-12-07 22:29:22 (GMT)
committerYann Collet <cyan@fb.com>2016-12-07 22:29:22 (GMT)
commit01ffed25adbb4d18e48ceac59b1e5174ae29fc7f (patch)
tree4b757ce5132e80cc7741ac65d365a47e9c1cb862 /programs/lz4cli.c
parent5eb547a6080b8e63b5e522b448e31052fbc6b927 (diff)
downloadlz4-01ffed25adbb4d18e48ceac59b1e5174ae29fc7f.zip
lz4-01ffed25adbb4d18e48ceac59b1e5174ae29fc7f.tar.gz
lz4-01ffed25adbb4d18e48ceac59b1e5174ae29fc7f.tar.bz2
fix : invocation of path/to/unlz4 (#284), reported by @beiDei8z
Diffstat (limited to 'programs/lz4cli.c')
-rw-r--r--programs/lz4cli.c9
1 files changed, 8 insertions, 1 deletions
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;