testutil: ensure good treatment of argv on non-Unix platforms
[openssl.git] / test / testutil / driver.c
index df62625fc05965e51796784eea1d44b4e7c19948..10d74e2ea47f882f53da9df947ebc840058b1d98 100644 (file)
@@ -17,6 +17,8 @@
 #include "internal/nelem.h"
 #include <openssl/bio.h>
 
+#include "platform.h"            /* From libapps */
+
 #ifdef _WIN32
 # define strdup _strdup
 #endif
@@ -132,6 +134,16 @@ int setup_test_framework(int argc, char *argv[])
         CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
     }
 #endif
+
+#if defined(OPENSSL_SYS_VMS) && defined(__DECC)
+    argv = copy_argv(&argc, argv);
+#elif defined(_WIN32)
+    /*
+     * Replace argv[] with UTF-8 encoded strings.
+     */
+    win32_utf8argv(&argc, &argv);
+#endif
+
     if (!opt_init(argc, argv, test_get_options()))
         return 0;
     return 1;