mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 22:43:45 +08:00
Merge pull request #1488 from stweil/cmdline
training: Fix dubious parsing of command line
This commit is contained in:
commit
36d6cb3a46
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user