4 #ifndef BUILDVER_INCLUDED
5 #include "buildver-boehm.h"
10 * If the MONO_ENV_OPTIONS environment variable is set, it uses this as a
11 * source of command line arguments that are passed to Mono before the
12 * command line arguments specified in the command line.
15 mono_main_with_options (int argc, char *argv [])
17 const char *env_options = g_getenv ("MONO_ENV_OPTIONS");
18 if (env_options != NULL){
19 GPtrArray *array = g_ptr_array_new ();
20 GString *buffer = g_string_new ("");
23 gboolean in_quotes = FALSE;
24 char quote_char = '\0';
26 for (p = env_options; *p; p++){
30 if (buffer->len != 0){
31 g_ptr_array_add (array, g_strdup (buffer->str));
32 g_string_truncate (buffer, 0);
35 g_string_append_c (buffer, *p);
40 g_string_append_c (buffer, p [1]);
50 g_string_append_c (buffer, *p);
57 g_string_append_c (buffer, *p);
62 fprintf (stderr, "Unmatched quotes in value of MONO_ENV_OPTIONS: [%s]\n", env_options);
67 g_ptr_array_add (array, g_strdup (buffer->str));
68 g_string_free (buffer, TRUE);
71 int new_argc = array->len + argc;
72 char **new_argv = g_new (char *, new_argc + 1);
75 new_argv [0] = argv [0];
77 /* First the environment variable settings, to allow the command line options to override */
78 for (i = 0; i < array->len; i++)
79 new_argv [i+1] = g_ptr_array_index (array, i);
81 for (j = 1; j < argc; j++)
82 new_argv [i++] = argv [j];
88 g_ptr_array_free (array, TRUE);
91 return mono_main (argc, argv);
104 argvw = CommandLineToArgvW (GetCommandLine (), &argc);
105 argv = g_new0 (gchar*, argc + 1);
106 for (i = 0; i < argc; i++)
107 argv [i] = g_utf16_to_utf8 (argvw [i], -1, NULL, NULL, NULL);
112 return mono_main_with_options (argc, argv);
118 main (int argc, char* argv[])
120 mono_build_date = build_date;
122 return mono_main_with_options (argc, argv);