Skip to content

Commit 724a72a

Browse files
committed
tesseractmain: Always use EXIT_SUCCESS and EXIT_FAILURE macros for exit status
Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent b5ac850 commit 724a72a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/api/tesseractmain.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static void SetVariablesFromCLArgs(tesseract::TessBaseAPI* api, int argc,
206206
char* p = strchr(opt1, '=');
207207
if (!p) {
208208
fprintf(stderr, "Missing = in configvar assignment\n");
209-
exit(1);
209+
exit(EXIT_FAILURE);
210210
}
211211
*p = 0;
212212
strncpy(opt2, strchr(argv[i + 1], '=') + 1, 255);
@@ -259,7 +259,7 @@ static void FixPageSegMode(tesseract::TessBaseAPI* api,
259259
static void checkArgValues(int arg, const char* mode, int count) {
260260
if (arg >= count || arg < 0) {
261261
printf("Invalid %s value, please enter a number between 0-%d\n", mode, count - 1);
262-
exit(0);
262+
exit(EXIT_SUCCESS);
263263
}
264264
}
265265

@@ -275,23 +275,23 @@ static void ParseArgs(const int argc, char** argv, const char** lang,
275275
if (argc == 2) {
276276
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
277277
PrintHelpMessage(argv[0]);
278-
exit(0);
278+
exit(EXIT_SUCCESS);
279279
}
280280
if (strcmp(argv[1], "--help-extra") == 0) {
281281
PrintHelpExtra(argv[0]);
282-
exit(0);
282+
exit(EXIT_SUCCESS);
283283
}
284284
if ((strcmp(argv[1], "--help-psm") == 0)) {
285285
PrintHelpForPSM();
286-
exit(0);
286+
exit(EXIT_SUCCESS);
287287
}
288288
if ((strcmp(argv[1], "--help-oem") == 0)) {
289289
PrintHelpForOEM();
290-
exit(0);
290+
exit(EXIT_SUCCESS);
291291
}
292292
if ((strcmp(argv[1], "-v") == 0) || (strcmp(argv[1], "--version") == 0)) {
293293
PrintVersionInfo();
294-
exit(0);
294+
exit(EXIT_SUCCESS);
295295
}
296296
}
297297

@@ -338,15 +338,15 @@ static void ParseArgs(const int argc, char** argv, const char** lang,
338338
} else {
339339
// Unexpected argument.
340340
fprintf(stderr, "Error, unknown command line argument '%s'\n", argv[i]);
341-
exit(1);
341+
exit(EXIT_FAILURE);
342342
}
343343
}
344344

345345
*arg_i = i;
346346

347347
if (*outputbase == nullptr && noocr == false) {
348348
PrintHelpMessage(argv[0]);
349-
exit(1);
349+
exit(EXIT_FAILURE);
350350
}
351351
}
352352

0 commit comments

Comments
 (0)