Skip to content

Commit 076f21c

Browse files
committed
Print version to stdout instead to stderr
Most command line programs print the version to stdout. This seams to be reasonable for Tesseract, too. Now a shell statement like "VERSION=$(tesseract --version)" works without I/O redirection. Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 32bbb95 commit 076f21c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

api/tesseractmain.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
void PrintVersionInfo() {
3737
char *versionStrP;
3838

39-
fprintf(stderr, "tesseract %s\n", tesseract::TessBaseAPI::Version());
39+
printf("tesseract %s\n", tesseract::TessBaseAPI::Version());
4040

4141
versionStrP = getLeptonicaVersion();
42-
fprintf(stderr, " %s\n", versionStrP);
42+
printf(" %s\n", versionStrP);
4343
lept_free(versionStrP);
4444

4545
versionStrP = getImagelibVersions();
46-
fprintf(stderr, " %s\n", versionStrP);
46+
printf(" %s\n", versionStrP);
4747
lept_free(versionStrP);
4848

4949
#ifdef USE_OPENCL
@@ -54,18 +54,18 @@ void PrintVersionInfo() {
5454
char info[256];
5555
int i;
5656

57-
fprintf(stderr, " OpenCL info:\n");
57+
printf(" OpenCL info:\n");
5858
clGetPlatformIDs(1, &platform, &num_platforms);
59-
fprintf(stderr, " Found %d platforms.\n", num_platforms);
59+
printf(" Found %d platforms.\n", num_platforms);
6060
clGetPlatformInfo(platform, CL_PLATFORM_NAME, 256, info, 0);
61-
fprintf(stderr, " Platform name: %s.\n", info);
61+
printf(" Platform name: %s.\n", info);
6262
clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 256, info, 0);
63-
fprintf(stderr, " Version: %s.\n", info);
63+
printf(" Version: %s.\n", info);
6464
clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 2, devices, &num_devices);
65-
fprintf(stderr, " Found %d devices.\n", num_devices);
65+
printf(" Found %d devices.\n", num_devices);
6666
for (i = 0; i < num_devices; ++i) {
6767
clGetDeviceInfo(devices[i], CL_DEVICE_NAME, 256, info, 0);
68-
fprintf(stderr, " Device %d name: %s.\n", i+1, info);
68+
printf(" Device %d name: %s.\n", i+1, info);
6969
}
7070
#endif
7171
}

0 commit comments

Comments
 (0)