int main(int argc, char **argv) { Client client = silc_calloc(1, sizeof(*client)); gclient = client; if (argc > 1) { if (!strcmp(argv[1], "-d")) silc_log_debug(TRUE); if (argc > 2 && !strcmp(argv[2], "-x")) silc_log_debug_hexdump(TRUE); silc_log_set_debug_string("*"); } client->schedule = silc_schedule_init(0, NULL); if (!client->schedule) return -1; /* Connecto to server */ silc_net_tcp_connect(NULL, "127.0.0.1", 5000, client->schedule, connect_callback, client); silc_schedule(client->schedule); return 0; }
void silc_client_run(SilcClient client) { SILC_LOG_DEBUG(("Starting SILC client")); /* Run the scheduler */ silc_schedule(client->schedule); }
int main(int argc, char **argv) { SilcBool success = FALSE; SilcSchedule schedule; SilcFSM fsm; Foo f; if (argc > 1 && !strcmp(argv[1], "-d")) { silc_log_debug(TRUE); silc_log_debug_hexdump(TRUE); silc_log_quick(TRUE); silc_log_set_debug_string("*fsm*,*async*"); } SILC_LOG_DEBUG(("Allocating scheduler")); schedule = silc_schedule_init(0, NULL); f = silc_calloc(1, sizeof(*f)); if (!f) goto err; f->schedule = schedule; SILC_LOG_DEBUG(("Allocating FSM context")); f->fsm = fsm = silc_fsm_alloc(f, destructor, f, schedule); if (!fsm) goto err; silc_fsm_start(fsm, test_st_start); SILC_LOG_DEBUG(("Running scheduler")); silc_schedule(schedule); if (f->error) goto err; silc_schedule_uninit(schedule); silc_free(f); success = TRUE; err: SILC_LOG_DEBUG(("Testing was %s", success ? "SUCCESS" : "FAILURE")); fprintf(stderr, "Testing was %s\n", success ? "SUCCESS" : "FAILURE"); return success; }
int main(int argc, char **argv) { SilcFSM fsm; if (argc > 1 && !strcmp(argv[1], "-d")) { silc_log_debug(TRUE); silc_log_debug_hexdump(TRUE); silc_log_set_debug_string("*fdstream*"); } SILC_LOG_DEBUG(("Allocating scheduler")); schedule = silc_schedule_init(0, NULL); if (!schedule) goto err; SILC_LOG_DEBUG(("Allocating FSM")); fsm = silc_fsm_alloc(NULL, fsm_dest, NULL, schedule); if (!fsm) goto err; silc_fsm_start(fsm, st_write); SILC_LOG_DEBUG(("Running scheduler")); silc_schedule(schedule); if (!success) goto err; silc_schedule_uninit(schedule); success = TRUE; err: SILC_LOG_DEBUG(("Testing was %s", success ? "SUCCESS" : "FAILURE")); fprintf(stderr, "Testing was %s\n", success ? "SUCCESS" : "FAILURE"); return success; }
int main(int argc, char **argv) { SilcFSM fsm; silc_runtime_init(); if (argc > 1 && !strcmp(argv[1], "-d")) { silc_log_debug(TRUE); silc_log_debug_hexdump(TRUE); silc_log_set_debug_string("*thread*"); } SILC_LOG_DEBUG(("Allocating scheduler")); schedule = silc_schedule_init(0, NULL, NULL, NULL); if (!schedule) goto err; SILC_LOG_DEBUG(("Allocating FSM context")); fsm = silc_fsm_alloc(NULL, destructor, NULL, schedule); if (!fsm) goto err; silc_fsm_start(fsm, test_st_start); SILC_LOG_DEBUG(("Running scheduler")); silc_schedule(schedule); silc_schedule_uninit(schedule); err: SILC_LOG_DEBUG(("Testing was %s", success ? "SUCCESS" : "FAILURE")); fprintf(stderr, "Testing was %s\n", success ? "SUCCESS" : "FAILURE"); silc_runtime_uninit(); return !success; }