1 int mono_main (int argc
, char* argv
[]);
9 static char **mono_options
= NULL
;
11 static int count_mono_options_args (void)
13 const char *e
= getenv ("MONO_BUNDLED_OPTIONS");
20 /* Don't bother with any quoting here. It is unlikely one would
21 * want to pass options containing spaces anyway.
26 while ((q
= strchr (p
, ' ')) != NULL
) {
31 mono_options
= malloc (sizeof (char *) * (n
+ 1));
35 while ((q
= strchr (p
, ' ')) != NULL
) {
36 mono_options
[i
] = malloc ((q
- p
) + 1);
37 memcpy (mono_options
[i
], p
, q
- p
);
38 mono_options
[i
][q
- p
] = '\0';
42 mono_options
[i
++] = strdup (p
);
43 mono_options
[i
] = NULL
;
49 int main (int argc
, char* argv
[])
55 /* CommandLineToArgvW() might return a different argc than the
56 * one passed to main(), so let it overwrite that, as we won't
57 * use argv[] on Windows anyway.
59 wchar_t **wargv
= CommandLineToArgvW (GetCommandLineW (), &argc
);
62 newargs
= (char **) malloc (sizeof (char *) * (argc
+ 2) + count_mono_options_args ());
65 newargs
[k
++] = g_utf16_to_utf8 (wargv
[0], -1, NULL
, NULL
, NULL
);
67 newargs
[k
++] = argv
[0];
70 if (mono_options
!= NULL
) {
72 while (mono_options
[i
] != NULL
)
73 newargs
[k
++] = mono_options
[i
++];
76 newargs
[k
++] = image_name
;
78 for (i
= 1; i
< argc
; i
++) {
80 newargs
[k
++] = g_utf16_to_utf8 (wargv
[i
], -1, NULL
, NULL
, NULL
);
82 newargs
[k
++] = argv
[i
];
90 if (config_dir
!= NULL
&& getenv ("MONO_CFG_DIR") == NULL
)
91 mono_set_dirs (getenv ("MONO_PATH"), config_dir
);
95 return mono_main (k
, newargs
);