aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/os_SUITE_data/my_echo.c
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2013-05-15 15:16:50 +0200
committerDan Gudmundsson <[email protected]>2013-06-03 12:58:45 +0200
commit0057676c3ebfd603658631088c977219ba2b0cc6 (patch)
tree879f3125ed8b569e25eefc02c3b5c5a201d824a3 /lib/kernel/test/os_SUITE_data/my_echo.c
parent892fb14882ef356c90eda8aa02ca43c3db8b53da (diff)
downloadotp-0057676c3ebfd603658631088c977219ba2b0cc6.tar.gz
otp-0057676c3ebfd603658631088c977219ba2b0cc6.tar.bz2
otp-0057676c3ebfd603658631088c977219ba2b0cc6.zip
kernel: Handle unicode in os:cmd
Allow unicode strings in os:cmd and try to convert the result bytes to unicode list. Also test it.
Diffstat (limited to 'lib/kernel/test/os_SUITE_data/my_echo.c')
-rw-r--r--lib/kernel/test/os_SUITE_data/my_echo.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/kernel/test/os_SUITE_data/my_echo.c b/lib/kernel/test/os_SUITE_data/my_echo.c
index 2127511dd1..712c828bb5 100644
--- a/lib/kernel/test/os_SUITE_data/my_echo.c
+++ b/lib/kernel/test/os_SUITE_data/my_echo.c
@@ -1,3 +1,30 @@
+#ifdef __WIN32__
+#include <windows.h>
+
+int wmain(int argc, wchar_t **argv)
+{
+ char* sep = "";
+ int len;
+
+ /*
+ * Echo all arguments separated with '::', so that we can check that
+ * quotes are interpreted correctly.
+ */
+
+ while (argc-- > 1) {
+ char *utf8;
+ len = WideCharToMultiByte(CP_UTF8, 0, argv[1], -1, NULL, 0, NULL, NULL);
+ utf8 = malloc(len*sizeof(char));
+ WideCharToMultiByte(CP_UTF8, 0, argv++[1], -1, utf8, len, NULL, NULL);
+ printf("%s%s", sep, utf8);
+ free(utf8);
+ sep = "::";
+ }
+ putchar('\n');
+ return 0;
+}
+#else
+
#include <stdio.h>
int
@@ -17,3 +44,4 @@ main(int argc, char** argv)
putchar('\n');
return 0;
}
+#endif