OSDN Git Service

Some Linux compile fixes.
authorLoRd_MuldeR <mulder2@gmx.de>
Mon, 8 Jan 2018 21:40:13 +0000 (22:40 +0100)
committerLoRd_MuldeR <mulder2@gmx.de>
Mon, 8 Jan 2018 21:40:13 +0000 (22:40 +0100)
src/main.c
src/utilities.h

index bc3a8c9..2f4ee2e 100644 (file)
@@ -94,7 +94,7 @@ static int process_file(const int multi_file, const param_t *const param, CHAR *
        /*check for interruption*/
        if (g_interrupted)
        {
-               FPRINTF(stderr, T("\nInterrupted!\n\n"));
+               FPUTS(T("\nInterrupted!\n\n"), stderr);
                return SIGINT;
        }
 
@@ -102,7 +102,7 @@ static int process_file(const int multi_file, const param_t *const param, CHAR *
        if (ferror(source))
        {
                print_logo();
-               FPRINTF(stderr, T("File read error has occurred!\n"));
+               FPUTS(T("File read error has occurred!\n"), stderr);
                fclose(source);
                return 0;
        }
@@ -111,7 +111,7 @@ static int process_file(const int multi_file, const param_t *const param, CHAR *
        if (param->show_progress)
        {
                print_progress(file_size, bytes_processed);
-               FPRINTF(stderr, T(" done\n"));
+               FPUTS(T(" done\n"), stderr);
                fflush(stderr);
        }
 
@@ -123,7 +123,7 @@ static int process_file(const int multi_file, const param_t *const param, CHAR *
        {
                if (fwrite(result, sizeof(uint8_t), MHASH_384_LEN, stdout) != MHASH_384_LEN)
                {
-                       FPRINTF(stderr, T("File write error has occurred!\n"));
+                       FPUTS(T("File write error has occurred!\n"), stderr);
                        if (source != stdin)
                        {
                                fclose(source);
@@ -189,7 +189,7 @@ int MAIN(int argc, CHAR *argv[])
                return 0;
        case OPMODE_TEST:
 #ifdef NO_SELFTEST
-               FPRINTF(stderr, "Not compiled with self-test code!\n");
+               FPUTS("Not compiled with self-test code!\n", stderr);
                return 1;
 #else
                return self_test();
@@ -200,7 +200,6 @@ int MAIN(int argc, CHAR *argv[])
 #ifdef _WIN32
        if (param.raw_output)
        {
-               fflush(stdout);
                _setmode(_fileno(stdout), _O_BINARY);
        }
 #endif
index f1d3ff2..24a603b 100644 (file)
@@ -108,18 +108,18 @@ static void print_help(void)
 {
        print_logo();
        FPRINTF(stderr, T("Built with %s v%u.%u.%u on %s [%s]\n\n"), T(COMPILER_TYPE), COMPILER_VERS_MAJOR, COMPILER_VERS_MINOR, COMPILER_VERS_PATCH, T(SYSTEM_TYPE), T(COMPILER_ARCH));
-       FPRINTF(stderr, T("Usage:\n"));
-       FPRINTF(stderr, T("  mhash384") T(EXE_SUFFIX) T(" [options] [input_file]...\n\n"));
-       FPRINTF(stderr, T("Options:\n"));
-       FPRINTF(stderr, T("  -p, --progress  show progress while processing\n"));
-       FPRINTF(stderr, T("  -u, --upper     print digest in upper case letters\n"));
-       FPRINTF(stderr, T("  -c, --curly     print digest using C-style curly brackets\n"));
-       FPRINTF(stderr, T("  -r, --raw       output \"raw\" bytes (no \"hex\" encoding)\n"));
-       FPRINTF(stderr, T("  -b, --bench     compute and print throughput\n"));
-       FPRINTF(stderr, T("  -v, --version   print the version string and exit\n"));
-       FPRINTF(stderr, T("  -t, --test      execute self-test and exit\n"));
-       FPRINTF(stderr, T("  -h, --help      print this help screen and exit\n\n"));
-       FPRINTF(stderr, T("If no input file is specified, input will be read from STDIN.\n\n"));
+       FPUTS(T("Usage:\n"), stderr);
+       FPRINTF(stderr, T("  mhash384%s [options] [input_file]...\n\n"), T(EXE_SUFFIX));
+       FPUTS(T("Options:\n"), stderr);
+       FPUTS(T("  -p, --progress  show progress while processing\n"), stderr);
+       FPUTS(T("  -u, --upper     print digest in upper case letters\n"), stderr);
+       FPUTS(T("  -c, --curly     print digest using C-style curly brackets\n"), stderr);
+       FPUTS(T("  -r, --raw       output \"raw\" bytes (no \"hex\" encoding)\n"), stderr);
+       FPUTS(T("  -b, --bench     compute and print throughput\n"), stderr);
+       FPUTS(T("  -v, --version   print the version string and exit\n"), stderr);
+       FPUTS(T("  -t, --test      execute self-test and exit\n"), stderr);
+       FPUTS(T("  -h, --help      print this help screen and exit\n\n"), stderr);
+       FPUTS(T("If no input file is specified, input will be read from STDIN.\n\n"), stderr);
 }
 
 /*Check specific option*/