]> granicus.if.org Git - curl/commitdiff
Call setlocale() for libtest tests to test the effects of locale-induced
authorDan Fandrich <dan@coneharvesters.com>
Wed, 21 Jan 2009 04:30:05 +0000 (04:30 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 21 Jan 2009 04:30:05 +0000 (04:30 +0000)
libc changes on libcurl.

tests/libtest/first.c

index 9b06f74bcfb32cdf3c503cf67d572f1c4dc32dbe..032704ca026d02b65e9d1b4ddc61761bc6953695 100644 (file)
 
 #include "test.h"
 
+#ifdef HAVE_LOCALE_H
+#include <locale.h> /* for setlocale() */
+#endif
+
 #ifdef CURLDEBUG
 #  define MEMDEBUG_NODEFINES
 #  include "memdebug.h"
@@ -60,6 +64,16 @@ int main(int argc, char **argv)
     curl_free(env);
   }
 #endif
+
+  /*
+   * Setup proper locale from environment. This is needed to enable locale-
+   * specific behaviour by the C library in order to test for undesired side
+   * effects that could cause in libcurl.
+   */
+#ifdef HAVE_SETLOCALE
+  setlocale(LC_ALL, "");
+#endif
+
   if(argc< 2 ) {
     fprintf(stderr, "Pass URL as argument please\n");
     return 1;