Imported Upstream version 7.40.0
[platform/upstream/curl.git] / tests / libtest / first.c
index 253acb2..5851faf 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
 #include "test.h"
 
 #ifdef HAVE_LOCALE_H
-#include <locale.h> /* for setlocale() */
+#  include <locale.h> /* for setlocale() */
+#endif
+
+#ifdef HAVE_IO_H
+#  include <io.h> /* for setmode() */
+#endif
+
+#ifdef HAVE_FCNTL_H
+#  include <fcntl.h> /* for setmode() */
 #endif
 
 #ifdef CURLDEBUG
@@ -51,6 +59,15 @@ int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
   return select(nfds, rd, wr, exc, tv);
 }
 
+void wait_ms(int ms)
+{
+  struct timeval t;
+  t.tv_sec = ms/1000;
+  ms -= (int)t.tv_sec * 1000;
+  t.tv_usec = ms * 1000;
+  select_wrapper(0, NULL, NULL , NULL, &t);
+}
+
 char *libtest_arg2=NULL;
 char *libtest_arg3=NULL;
 int test_argc;
@@ -98,6 +115,14 @@ int main(int argc, char **argv)
 {
   char *URL;
 
+#ifdef O_BINARY
+#  ifdef __HIGHC__
+  _setmode(stdout, O_BINARY);
+#  else
+  setmode(fileno(stdout), O_BINARY);
+#  endif
+#endif
+
   memory_tracking_init();
 
   /*