Skip to content

Commit

Permalink
avoid using less portable basename() (fixes #1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Dec 25, 2023
1 parent a9a2484 commit e59fbc4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/utils/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ void argHelp(const char* name, const argParseOpt *parseOpt) {
} else if (indent < MIN_INDENT) {
indent = MIN_INDENT;
}
printf("Usage: %s [OPTION...]", basename(name));
const char* basename = strrchr(name, '/');
basename = basename ? basename+1 : name;
printf("Usage: %s [OPTION...]", basename);
for (const argDef *arg = parseOpt->argDefs; arg && arg->help; arg++) {
if (arg->name || !arg->valueName) {
continue;
Expand Down

0 comments on commit e59fbc4

Please sign in to comment.