Skip to content

Commit

Permalink
Merge pull request #1488 from stweil/cmdline
Browse files Browse the repository at this point in the history
training: Fix dubious parsing of command line
  • Loading branch information
zdenop committed Apr 18, 2018
2 parents 9e69eca + 8f656e4 commit 36d6cb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions training/commandlineflags.cpp
Expand Up @@ -170,14 +170,14 @@ void ParseCommandLineFlags(const char* usage,
break;
}
// Position current_arg after startings hyphens. We treat a sequence of
// consecutive hyphens of any length identically.
while (*current_arg == '-') {
// one or two consecutive hyphens identically.
++current_arg;
if (current_arg[0] == '-') {
++current_arg;
}
// If this is asking for usage, print the help message and abort.
if (!strcmp(current_arg, "help") ||
!strcmp(current_arg, "helpshort")) {
printf("USAGE: %s\n", usage);
if (!strcmp(current_arg, "help")) {
printf("Usage:\n %s [OPTION ...]\n\n", usage);
PrintCommandLineFlags();
exit(0);
}
Expand Down
2 changes: 1 addition & 1 deletion training/commandlineflags.h
Expand Up @@ -67,7 +67,7 @@
namespace tesseract {

// Parse commandline flags and values. Prints the usage string and exits on
// input of --help or --helpshort.
// input of --help or --version.
//
// If remove_flags is true, the argv pointer is advanced so that (*argv)[1]
// points to the first non-flag argument, (*argv)[0] points to the same string
Expand Down

0 comments on commit 36d6cb3

Please sign in to comment.