/* * initialize a conn object with the default conn */ static void conn_default(char *name, starter_conn_t *conn, starter_conn_t *def) { memcpy(conn, def, sizeof(starter_conn_t)); conn->name = strdupnull(name); clone_args(KW_CONN_FIRST, KW_CONN_LAST, (char *)conn, (char *)def); clone_args(KW_END_FIRST, KW_END_LAST, (char *)&conn->left, (char *)&def->left); clone_args(KW_END_FIRST, KW_END_LAST, (char *)&conn->right, (char *)&def->right); }
/* * initialize a ca object with the default ca */ static void ca_default(char *name, starter_ca_t *ca, starter_ca_t *def) { memcpy(ca, def, sizeof(starter_ca_t)); ca->name = strdupnull(name); clone_args(KW_CA_FIRST, KW_CA_LAST, (char *)ca, (char *)def); }
static void rpc_test_init_invoke (gchar **program_args) { gchar **args = NULL; gint n, rc = 0; if ((args = clone_args (program_args)) == NULL) g_error ("could not clone program arguments"); n = g_strv_length (args); if (rpc_test_init) rc = rpc_test_init (n, args); g_strfreev (args); RPC_TEST_ENSURE (rc == 0); g_timeout_add (0, rpc_test_execute_cb, NULL); }
int main(int argc, char *argv[]) { char option[2]; int n; int err=0; if(!argc) usage(argv[0]); clone_args( argv, argc ); #if !GLIB_CHECK_VERSION(2,36,0) g_type_init(); #endif gtk_init( &argc, &argv ); // default host to connect to snprintf(hostname,sizeof(hostname), "127.0.0.1"); while( ( n = getopt( argc, argv, "s:h:p:tabnvLHfX:P:Vl:T:m:g:")) != EOF ) { sprintf(option, "%c", n ); err += set_option( option, optarg); if(err) usage(argv[0]); } if( optind > argc ) err ++; if( err ) usage(argv[0]); glade_init(); vj_mem_init(); vevo_strict_init(); find_user_themes(gveejay_theme); vj_gui_set_debug_level( verbosity , n_tracks,0,0); set_skin( selected_skin, gveejay_theme ); default_bank_values( &col, &row ); gui_load_theme(); register_signals(); vj_gui_init( skins[selected_skin].file, launcher, hostname, port_num, use_threads, load_midi, midi_file,beta,auto_connect); vj_gui_style_setup(); if( preview ) { veejay_msg(VEEJAY_MSG_INFO, "Starting with preview enabled"); gveejay_preview(preview); } if( launcher ) { reloaded_launcher( hostname, port_num ); } memset( &time_last_, 0, sizeof(struct timeval)); while(gveejay_running()) { if(gveejay_idle(NULL)==FALSE) break; while( gtk_events_pending() ) gtk_main_iteration(); } veejay_msg(VEEJAY_MSG_INFO, "See you!"); return 0; }
int main (int argc, char *argv[]) { if (rpc_test_get_connection_path) g_connection_path = rpc_test_get_connection_path (); else g_connection_path = NPW_CONNECTION_PATH "/Test.RPC"; #ifdef BUILD_CLIENT gchar **child_args; if (argc < 2) g_error ("no server program provided on command line"); signal (SIGSEGV, urgent_exit_sig); signal (SIGBUS, urgent_exit_sig); signal (SIGINT, urgent_exit_sig); signal (SIGABRT, urgent_exit_sig); if ((child_args = clone_args (argv)) == NULL) g_error ("could not create server program arguments\n"); g_free (child_args[0]); child_args[0] = g_strdup (argv[1]); if (!g_spawn_async (NULL, child_args, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &g_child_pid, NULL)) g_error ("could not start server program '%s'", child_args[0]); g_strfreev (child_args); if ((g_connection = rpc_init_client (g_connection_path)) == NULL) g_error ("failed to initialize RPC client connection"); #endif #ifdef BUILD_SERVER if ((g_connection = rpc_init_server (g_connection_path)) == NULL) g_error ("failed to initialize RPC server connection"); #endif int fd = -1; GSource *rpc_source = NULL; guint rpc_source_id = 0; GPollFD rpc_event_poll_fd; #ifdef BUILD_CLIENT fd = rpc_socket (g_connection); #endif #ifdef BUILD_SERVER fd = rpc_listen_socket (g_connection); #endif RPC_TEST_ENSURE (fd >= 0); if ((rpc_source = g_source_new (&rpc_event_funcs, sizeof (GSource))) == NULL) g_error ("failed to initialize RPC source"); rpc_source_id = g_source_attach (rpc_source, NULL); memset (&rpc_event_poll_fd, 0, sizeof (rpc_event_poll_fd)); rpc_event_poll_fd.fd = fd; rpc_event_poll_fd.events = G_IO_IN; rpc_event_poll_fd.revents = 0; g_source_add_poll (rpc_source, &rpc_event_poll_fd); static const rpc_method_descriptor_t vtable[] = { { RPC_TEST_METHOD_EXIT, handle_rpc_test_exit } }; if (rpc_connection_add_method_descriptor (g_connection, &vtable[0]) < 0) g_error ("could not add method descriptor for TEST_RPC_METHOD_EXIT"); g_main_loop = g_main_loop_new (NULL, TRUE); #ifdef BUILD_CLIENT g_child_watch_id = g_child_watch_add (g_child_pid, child_exited_cb, NULL); #endif rpc_test_init_invoke (argv); g_main_loop_run (g_main_loop); if (rpc_source_id) g_source_remove (rpc_source_id); if (g_connection) rpc_exit (g_connection); return g_exit_status; }