return 0;
}
+static int parse_options_wrapper(int argc, char *argv[], CParserOption* po, bool first_time ) {
+ // copy, as arg parser sometimes changes the argv
+ char ** argv_copy = (char **) malloc(sizeof(char *) * argc);
+ for(int i=0; i<argc; i++) {
+ argv_copy[i] = strdup(argv[i]);
+ }
+ int ret = parse_options(argc, argv_copy, po, first_time);
+
+ // free
+ for(int i=0; i<argc; i++) {
+ free(argv_copy[i]);
+ }
+ free(argv_copy);
+ return ret;
+}
int main_test(int argc , char * argv[]);
CGlobalInfo::m_options.preview.clean();
- if ( parse_options(argc, argv, &CGlobalInfo::m_options,true ) != 0){
+ if ( parse_options_wrapper(argc, argv, &CGlobalInfo::m_options,true ) != 0){
exit(-1);
}
update_global_info_from_platform_file();
/* It is not a mistake. Give the user higher priorty over the configuration file */
- parse_options(argc, argv, &CGlobalInfo::m_options ,false);
+ if (parse_options_wrapper(argc, argv, &CGlobalInfo::m_options ,false) != 0) {
+ exit(-1);
+ }
if ( CGlobalInfo::m_options.preview.getVMode() > 0){