| 173 | } |
| 174 | |
| 175 | void SetVariablesFromCLArgs(tesseract::TessBaseAPI* api, int argc, |
| 176 | char** argv) { |
| 177 | char opt1[256], opt2[255]; |
| 178 | for (int i = 0; i < argc; i++) { |
| 179 | if (strcmp(argv[i], "-c") == 0 && i + 1 < argc) { |
| 180 | strncpy(opt1, argv[i + 1], 255); |
| 181 | opt1[255] = '\0'; |
| 182 | char* p = strchr(opt1, '='); |
| 183 | if (!p) { |
| 184 | fprintf(stderr, "Missing = in configvar assignment\n"); |
| 185 | exit(1); |
| 186 | } |
| 187 | *p = 0; |
| 188 | strncpy(opt2, strchr(argv[i + 1], '=') + 1, 255); |
| 189 | opt2[254] = 0; |
| 190 | ++i; |
| 191 | |
| 192 | if (!api->SetVariable(opt1, opt2)) { |
| 193 | fprintf(stderr, "Could not set option: %s=%s\n", opt1, opt2); |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | void PrintLangsList(tesseract::TessBaseAPI* api) { |
| 200 | GenericVector<STRING> languages; |