diff --git a/training/commandlineflags.cpp b/training/commandlineflags.cpp index b4ab136b33..9c61386dff 100644 --- a/training/commandlineflags.cpp +++ b/training/commandlineflags.cpp @@ -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); } diff --git a/training/commandlineflags.h b/training/commandlineflags.h index d791bf48ed..ef76747896 100644 --- a/training/commandlineflags.h +++ b/training/commandlineflags.h @@ -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