commit 13e0561eb5ca3bc1ff2d9a2e49b4dd2810905c3b
parent c0024f2f87a18a11432f0f9f9c1f3b23cc2f7b84
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Sun, 5 Apr 2020 17:18:24 +0200
Fix a crash when running help
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/stardis-parsing.c b/src/stardis-parsing.c
@@ -363,15 +363,16 @@ short_help
(FILE* stream,
const char* prog)
{
- char* name;
+ const char* name;
ASSERT(stream && prog);
#ifdef COMPILER_GCC
- name = 1 + strrchr(prog, '/');
+ name = strrchr(prog, '/');
#else
- name = 1 + strrchr(prog, '\\');
+ name = strrchr(prog, '\\');
#endif
+ name = name ? name + 1 : prog;
fprintf(stream,
"Usage: %s [OPTIONS]\n"
"\nSolve coupled thermal systems under the linear assumption.\n"