]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost12sum.c
Fix MSVS2017 build errors.
[openssl-gost/engine.git] / gost12sum.c
index 7c02c8e8918cfff81ab7c0b059a57b00c3a94820..15e2941f613c9c4ac869eae9a4fe2ea304303814 100644 (file)
  **********************************************************************/
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef _MSC_VER
+#include "getopt.h"
+# ifndef PATH_MAX
+#  define PATH_MAX _MAX_PATH
+# endif
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#else
 #include <unistd.h>
+#endif
 #include <limits.h>
 #include <fcntl.h>
 #ifdef _WIN32
@@ -34,18 +43,17 @@ int hash_file(gost_hash_ctx * ctx, char *filename, char *sum, int mode);
 int hash_stream(gost_hash_ctx * ctx, int fd, char *sum);
 int get_line(FILE *f, char *hash, char *filename, int verbose);
 
-void help(const char *progname)
+void help()
 {
     fprintf(stderr, "Calculates GOST R 34.11-2012 hash function\n\n");
-    fprintf(stderr, "%s [-bvl] [-c [file]]| [files]|-x\n"
+    fprintf(stderr, "gostsum12 [-bvl] [-c [file]]| [files]|-x\n"
             "\t-c check message digests (default is generate)\n"
             "\t-v verbose, print file names when checking\n"
             "\t-b read files in binary mode\n"
             "\t-l use 512 bit hash (default 256 bit)\n"
             "\t-x read filenames from stdin rather than from arguments \n"
             "The input for -c should be the list of message digests and file names\n"
-                  "that is printed on stdout by this program when it generates"
-                  "digests.\n", progname);
+            "that is printed on stdout by this program when it generates digests.\n");
     exit(3);
 }
 
@@ -108,7 +116,7 @@ int main(int argc, char **argv)
             break;
         default:
             fprintf(stderr, "invalid option %c", optopt);
-            help(argv[0]);
+            help();
         }
     }
     if (check_file) {