[llvm] Fix support for native types.
[mono.git] / mono / mini / main.c
index 6e01e99fd3b903572c008a389db3ac7f5901563f..84c6f39c060ee71bee15b5c0b0c38af2d0d75b05 100644 (file)
@@ -1,10 +1,8 @@
 #include <config.h>
 #include "mini.h"
 #ifndef HOST_WIN32
-#ifdef HAVE_SGEN_GC
-#include "buildver-sgen.h"
-#else
-#include "buildver.h"
+#ifndef BUILDVER_INCLUDED
+#include "buildver-boehm.h"
 #endif
 #endif
 
 static int
 mono_main_with_options (int argc, char *argv [])
 {
-       const char *env_options = getenv ("MONO_ENV_OPTIONS");
+       const char *env_options = g_getenv ("MONO_ENV_OPTIONS");
        if (env_options != NULL){
                GPtrArray *array = g_ptr_array_new ();
                GString *buffer = g_string_new ("");
                const char *p;
                int i;
+               gboolean in_quotes = FALSE;
+               char quote_char = '\0';
 
                for (p = env_options; *p; p++){
                        switch (*p){
                        case ' ': case '\t':
-                               if (buffer->len != 0){
-                                       g_ptr_array_add (array, g_strdup (buffer->str));
-                                       g_string_truncate (buffer, 0);
+                               if (!in_quotes) {
+                                       if (buffer->len != 0){
+                                               g_ptr_array_add (array, g_strdup (buffer->str));
+                                               g_string_truncate (buffer, 0);
+                                       }
+                               } else {
+                                       g_string_append_c (buffer, *p);
                                }
                                break;
                        case '\\':
@@ -37,11 +41,28 @@ mono_main_with_options (int argc, char *argv [])
                                        p++;
                                }
                                break;
+                       case '\'':
+                       case '"':
+                               if (in_quotes) {
+                                       if (quote_char == *p)
+                                               in_quotes = FALSE;
+                                       else
+                                               g_string_append_c (buffer, *p);
+                               } else {
+                                       in_quotes = TRUE;
+                                       quote_char = *p;
+                               }
+                               break;
                        default:
                                g_string_append_c (buffer, *p);
                                break;
                        }
                }
+               if (in_quotes) {
+                       fprintf (stderr, "Unmatched quotes in value of MONO_ENV_OPTIONS: [%s]\n", env_options);
+                       exit (1);
+               }
+                       
                if (buffer->len != 0)
                        g_ptr_array_add (array, g_strdup (buffer->str));
                g_string_free (buffer, TRUE);
@@ -73,7 +94,7 @@ mono_main_with_options (int argc, char *argv [])
 #ifdef HOST_WIN32
 
 int
-main ()
+main (void)
 {
        int argc;
        gunichar2** argvw;