Skip to content

Commit

Permalink
scanner: remove BASENAME(); don't strip path from program_name
Browse files Browse the repository at this point in the history
There's no technical need of stripping path from program_name. I think
the users should be fine if they see the path they use to invoke flex
is diagnostic messages and help texts.

Yes, users will see "Usage: ../flex [OPTIONS]..." now if they invoke
flex with the path "../flex".

The --version output has been changed so that the name field will be
always "flex" or "flex++". If the flex program has been renamed to
"lex" (for compatibility or other reason) this will allow identifying
the implementation name ("flex"). (And it's a recommended practice in
GNU Coding Standards)
  • Loading branch information
Explorer09 authored and westes committed Aug 24, 2017
1 parent d64a526 commit fb731ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ void flexinit (int argc, char **argv)
flex_init_regex();

/* Enable C++ if program name ends with '+'. */
program_name = BASENAME(argv[0]);
program_name = argv[0];

if (program_name != NULL &&
program_name[strlen (program_name) - 1] == '+')
Expand Down Expand Up @@ -1208,7 +1208,7 @@ void flexinit (int argc, char **argv)
break;

case OPT_VERSION:
printf (_("%s %s\n"), program_name, flex_version);
printf (_("%s %s\n"), (C_plus_plus ? "flex++" : "flex"), flex_version);
FLEX_EXIT (0);

case OPT_WARN:
Expand Down
2 changes: 1 addition & 1 deletion src/scanopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ int scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
fprintf (fp, "%s\n", usage);
}
else {
fprintf (fp, _("Usage: %s [OPTIONS]...\n"), BASENAME(s->argv[0]) );
fprintf (fp, _("Usage: %s [OPTIONS]...\n"), s->argv[0]);
}
fprintf (fp, "\n");

Expand Down

0 comments on commit fb731ac

Please sign in to comment.