int main(int argc, char **argv) { char *xml_buf = NULL; DBus_Object *obj = NULL; char *prefix = NULL, *interface = NULL, *output = NULL; Eina_Bool quit_option = EINA_FALSE; int arg_index; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_STR(prefix), ECORE_GETOPT_VALUE_STR(interface), ECORE_GETOPT_VALUE_STR(output), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; eina_init(); arg_index = ecore_getopt_parse(&optdesc, values, argc, argv); if (arg_index == -1) { printf("Error: parsing arguments.\n"); return -1; } if (quit_option) return 0; if (argc <= arg_index) { printf("Error: Missing file name.\n"); return -1; } if (!file_read(argv[arg_index], &xml_buf)) { printf("Error reading file.\n"); goto end; } if (!eina_simple_xml_parse(xml_buf, strlen(xml_buf), EINA_TRUE, parser, &obj)) { printf("Error: could not parse XML\n"); goto end; } source_client_generate(obj, prefix, interface, output); util_h_write(); end: if (obj) object_free(obj); free(xml_buf); eina_shutdown(); return 0; }
static Eina_Bool _args_init(int argc, char **argv) { e = calloc(1, sizeof(Ewallset)); int arg_index; char *image_file; Ecore_Getopt_Value general_values[] = { ECORE_GETOPT_VALUE_STR(image_file), ECORE_GETOPT_VALUE_BOOL(e->quit_bool), ECORE_GETOPT_VALUE_BOOL(e->quit_bool), ECORE_GETOPT_VALUE_BOOL(e->quit_bool), ECORE_GETOPT_VALUE_BOOL(e->quit_bool), ECORE_GETOPT_VALUE_NONE }; arg_index = ecore_getopt_parse(&general_opts, general_values, argc, argv); if (arg_index <= 1) { printf("Try `ewallset --help' for more information.\n"); e->quit_bool = EINA_TRUE; } e->image_file = eina_stringshare_add(image_file); if (e->quit_bool) exit(0); return EINA_TRUE; }
int elm_main(int argc, char **argv) { unsigned char exit_option = 0; char *library_path = NULL; enlil_init(); APP_LOG_DOMAIN = eina_log_domain_register("Enki-Slideshow", "\033[34;1m"); //ecore_getopt Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_STR(library_path), ECORE_GETOPT_VALUE_BOOL(exit_option), }; ecore_app_args_set(argc, (const char **) argv); int nonargs = ecore_getopt_parse(&options, values, argc, argv); if (nonargs < 0) return 1; else if (nonargs != argc || !library_path) { fputs("Invalid non-option argument", stderr); ecore_getopt_help(stderr, &options); return 1; } if (exit_option) return 0; // elm_config_finger_size_set(1); // library = enlil_library_new(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); enlil_library_path_set(library, library_path); Enlil_Load *load = enlil_load_new(library, _load_album_done_cb, _load_done_cb, _load_error_cb, library); enlil_load_run(load); // elm_run(); enlil_shutdown(); elm_shutdown(); return 0; }
int main(int argc, char *argv[]) { const char *url; int args = 1; char *engine = NULL; unsigned char quitOption = 0; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_STR(engine), ECORE_GETOPT_VALUE_BOOL(quitOption), ECORE_GETOPT_VALUE_BOOL(quitOption), ECORE_GETOPT_VALUE_BOOL(quitOption), ECORE_GETOPT_VALUE_BOOL(quitOption), ECORE_GETOPT_VALUE_NONE }; if (!ewk_init()) return EXIT_FAILURE; ecore_app_args_set(argc, (const char **) argv); args = ecore_getopt_parse(&options, values, argc, argv); if (args < 0) return quit(EINA_FALSE, "ERROR: could not parse options.\n"); if (quitOption) return quit(EINA_TRUE, NULL); if (args < argc) url = argv[args]; else url = DEFAULT_URL; MiniBrowser *browser = browserCreate(url, engine); if (!browser) return quit(EINA_FALSE, "ERROR: could not create browser.\n"); Ecore_Event_Handler *handle = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, 0); ecore_main_loop_begin(); ecore_event_handler_del(handle); ecore_evas_free(browser->ee); free(browser); return quit(EINA_TRUE, NULL); }
int main(int argc, char **argv) { unsigned char exit_option = 0; char *library_path = NULL; enlil_init(); LOG_DOMAIN = eina_log_domain_register("bin_load_sync", "\033[34;1m"); //ecore_getopt Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_STR(library_path), ECORE_GETOPT_VALUE_BOOL(exit_option), }; ecore_app_args_set(argc, (const char **)argv); int nonargs = ecore_getopt_parse(&options, values, argc, argv); if (nonargs < 0) return 1; else if (nonargs != argc) { fputs("Invalid non-option argument", stderr); ecore_getopt_help(stderr, &options); return 1; } if(!library_path) { fprintf(stderr, "You must specify the location of your enlil !\n"); return 0; } if(exit_option) return 0; // Enlil_Library *library = enlil_library_new(_monitor_album_new_cb, _monitor_album_delete_cb, _monitor_enlil_delete_cb, _monitor_photo_new_cb, _monitor_photo_delete_cb, _monitor_photo_update_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); enlil_library_path_set(library, library_path); Enlil_Sync *_sync = enlil_sync_new(enlil_library_path_get(library), _sync_album_new_cb, _sync_album_update_cb, _sync_album_disappear_cb, _sync_photo_new_cb, _sync_photo_update_cb, _sync_photo_disappear_cb, _sync_done_cb, _sync_start_cb, _sync_error_cb, library); enlil_library_sync_set(library, _sync); Enlil_Load *load = enlil_load_new(library, _load_album_done_cb, _load_done_cb, _load_error_cb, library); enlil_library_monitor_start(library); t0 = ecore_time_get(); enlil_load_run(load); ecore_main_loop_begin(); enlil_sync_free(&_sync); enlil_library_free(&library); eina_log_domain_unregister(LOG_DOMAIN); enlil_shutdown(); return 0; }
int main(int argc EINA_UNUSED, char **argv EINA_UNUSED) { Suite *s; SRunner *sr; TCase *tc = NULL; char *test = NULL; unsigned int i; int failed_count = -1; int args; Eina_Bool quit_option = EINA_FALSE; Eina_Bool list_option = EINA_FALSE; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(list_option), ECORE_GETOPT_VALUE_STR(test), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; eina_init(); args = ecore_getopt_parse(&optdesc, values, argc, argv); if (args < 0) { EINA_LOG_CRIT("Could not parse arguments."); goto end; }
int main(int argc, char *argv[]) { Eina_Bool quit_option = EINA_FALSE; char *source = NULL, *header = NULL; int arg_index, ret = 0; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_STR(prefix), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; setlocale(LC_NUMERIC, "C"); eina_init(); ecore_init(); ecore_evas_init(); edje_init(); if (argc < 2) { fprintf(stderr, "Missing action. See '--help or -h'.\n"); ret = 1; goto error_log; } _log_dom = eina_log_domain_register("elementary_codegen", EINA_COLOR_YELLOW); if (_log_dom < 0) { EINA_LOG_CRIT("could not register log domain 'elementary_codegen'"); ret = 1; goto error_log; } arg_index = ecore_getopt_parse(&optdesc, values, argc, argv); if (arg_index < 0) { ERR("could not parse arguments."); ret = 1; goto error_getopt; } else if (quit_option) goto error_getopt; else if (arg_index != argc - 4) { fprintf(stderr, "Incorrect number of parameters. Requires " \ "fours arguments, an edje, the group, " \ "the source output (foo.c) and the header(foo.h).\n" \ "See %s --help\n", argv[0]); ret = 1; goto error_getopt; } file = argv[arg_index++]; // check if the file is accessible if (access(file, R_OK) == -1) { ERR("File '%s' not accessible, error %d (%s).\n", file, errno, strerror(errno)); ret = 1; goto error_getopt; } group = argv[arg_index++]; source = argv[arg_index++]; header = argv[arg_index++]; if (!edje_file_group_exists(file, group)) { ERR("The group %s not exists", group); ret = 2; goto error_getopt; } ee = ecore_evas_buffer_new(1, 1); if (!ee) { ERR("could not create ecore_evas_buffer"); ret = 3; goto error_getopt; } if (!_file_descriptors_open(source, header)) { ERR("Could not create the source files, error %d (%s)", errno, strerror(errno)); ret = 4; goto error_getopt; } if (!_headers_write(header)) { ERR("Could not write the header, error %d (%s)", errno, strerror(errno)); ret = 5; goto error_getopt; } if (!_theme_set_write()) WRN("Theme set getter/setter not created. Group name: %s invalid.", group); if (!_parse()) { ERR("Could not parsing the EDJE"); ret = 6; goto error_getopt; } if (!_footer_write(header)) { ERR("Could not write the footer, error %d (%s)", errno, strerror(errno)); ret = 7; goto error_getopt; } if (!_file_descriptors_close()) { ERR("Could not close the source files, error %d (%s)", errno, strerror(errno)); ret = 8; } error_getopt: if (ee) ecore_evas_free(ee); error_log: edje_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); eina_log_domain_unregister(_log_dom); eina_shutdown(); if (ret > 4) { unlink(header); unlink(source); } return ret; }
EAPI_MAIN int elm_main(int argc, char **argv) { char *theme = NULL; int args; unsigned char quit_option = 0; Eina_Rectangle geometry = {0, 0, 0, 0}; Eina_Bool is_fullscreen = 0; Enna *enna; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(is_fullscreen), ECORE_GETOPT_VALUE_PTR_CAST(geometry), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_STR(theme), ECORE_GETOPT_VALUE_NONE }; eina_init(); ecore_app_args_set(argc, (const char **) argv); args = ecore_getopt_parse(&_options, values, argc, argv); if (args < 0) { ERR("Could not parse options !"); return EXIT_FAILURE; } if (quit_option) return EXIT_SUCCESS; if (!enna_init()) goto shutdown; if (!enna_config_init()) goto shutdown_enna; if (theme) enna_config_theme_set(theme); if (!ems_init(enna_config_config_get(), EINA_FALSE)) goto shutdown_config; enna = enna_add(is_fullscreen, geometry); if (!enna) goto shutdown_config; // INF("Start scanner"); // ems_scanner_start(); INF("Start services annoucement"); ems_avahi_start(); ems_run(); ems_shutdown(); enna_config_shutdown(); enna_shutdown(); elm_shutdown(); return EXIT_SUCCESS; shutdown_config: enna_config_shutdown(); shutdown_enna: enna_shutdown(); shutdown: enna_shutdown(); return -1; }