static int captured_command_loop (void *data) { struct ui *ui = current_ui; /* Top-level execution commands can be run in the background from here on. */ current_ui->async = 1; /* Give the interpreter a chance to print a prompt, if necessary */ if (ui->prompt_state != PROMPT_BLOCKED) interp_pre_command_loop (top_level_interpreter ()); /* Now it's time to start the event loop. */ start_event_loop (); /* FIXME: cagney/1999-11-05: A correct command_loop() implementaton would clean things up (restoring the cleanup chain) to the state they were just prior to the call. Technically, this means that the do_cleanups() below is redundant. Unfortunately, many FUNCs are not that well behaved. do_cleanups should either be replaced with a do_cleanups call (to cover the problem) or an assertion check to detect bad FUNCs code. */ do_cleanups (all_cleanups ()); /* If the command_loop returned, normally (rather than threw an error) we try to quit. If the quit is aborted, catch_errors() which called this catch the signal and restart the command loop. */ quit_command (NULL, ui->instream == ui->stdin_stream); return 1; }
int main(int argc, char **argv) { struct sigaction sigact = { { 0 } }; int ret = 0; config_filename = av_strdup("/etc/ffserver.conf"); av_lfg_init(&random_state, av_get_random_seed()); if ((ret = parse_ffconfig(config_filename)) < 0) { fprintf(stderr, "Error reading configuration file '%s': %s\n", config_filename, av_err2str(ret)); exit(1); } av_freep(&config_filename); // set logfile logfile = stdout; build_file_streams(); /* signal init */ signal(SIGPIPE, SIG_IGN); if (start_event_loop() < 0) { // http_log("Could not start server\n"); printf("could not start server\n"); exit(1); } return 0; }
/* Initialize all the necessary variables, start the event loop, register readline, and stdin, start the loop. */ void cli_command_loop (void *data /* unused */) { int length; char *a_prompt; char *gdb_prompt = get_prompt (); /* If we are using readline, set things up and display the first prompt, otherwise just print the prompt. */ if (async_command_editing_p) { /* Tell readline what the prompt to display is and what function it will need to call after a whole line is read. This also displays the first prompt. */ length = strlen (PREFIX (0)) + strlen (gdb_prompt) + strlen (SUFFIX (0)) + 1; a_prompt = (char *) xmalloc (length); strcpy (a_prompt, PREFIX (0)); strcat (a_prompt, gdb_prompt); strcat (a_prompt, SUFFIX (0)); rl_callback_handler_install (a_prompt, input_handler); } else display_gdb_prompt (0); /* Now it's time to start the event loop. */ start_event_loop (); }
int uwrapc_network_main(int argc, char ** argv){ #ifndef NETWORK_SUPPORT hawk_fatal("uwrapc_network_main reached without network support!"); #else init_qt(argc,argv); char * server = 0; int server_port = 0; int key = 0; if(argc == 1){ /* don't try to connect to any server*/ return uwrapc_from_file(argc,argv); }else if(argc == 2){ server = argv[1]; server_port = rpcDefaultPort; }else if(argc == 3){ server = argv[1]; server_port = atoi(argv[2]); }else if(argc == 3){ server = argv[1]; server_port = atoi(argv[2]); }else if(argc == 4){ server = argv[1]; server_port = atoi(argv[2]); key = atoi(argv[3]); }else{ printf("Usage: uwrapc [server [port [key]]]\n"); return 0; } attempt_connection(server,server_port,key); return start_event_loop(); #endif }
void cli_command_loop (void *data) { display_gdb_prompt (0); /* Now it's time to start the event loop. */ start_event_loop (); }
static void mi_command_loop (int mi_version) { /* Turn off 8 bit strings in quoted output. Any character with the high bit set is printed using C's octal format. */ sevenbit_strings = 1; /* Tell the world that we're alive */ fputs_unfiltered ("(gdb) \n", raw_stdout); gdb_flush (raw_stdout); start_event_loop (); }
int main() { Init(); #ifndef MODULAR //Banner(); #endif if(PWR_CheckPowerSwitch()) PWR_Shutdown(); LCD_Clear(0x0000); #ifdef TEST_ADC ADC_ScanChannels(); while(1); #endif u32 buttons = ScanButtons(); if(CHAN_ButtonIsPressed(buttons, BUT_ENTER) || !FS_Mount(NULL, NULL)) { LCD_DrawUSBLogo(LCD_WIDTH, LCD_HEIGHT); USB_Connect(); LCD_Clear(0x0000); FS_Mount(NULL, NULL); } CONFIG_LoadTx(); SPI_ProtoInit(); CONFIG_ReadDisplay(); CONFIG_ReadModel(CONFIG_GetCurrentModel()); CONFIG_ReadLang(Transmitter.language); BACKLIGHT_Brightness(Transmitter.backlight); LCD_Contrast(Transmitter.contrast); LCD_SetFont(DEFAULT_FONT.font); LCD_SetFontColor(DEFAULT_FONT.font_color); #if !HAS_EXTENDED_AUDIO // If Extended Audio is present, move startup msg to Splash page to allow additional audio hardware initialization time MUSIC_Play(MUSIC_STARTUP); #else if (Transmitter.splash_delay < 5) MUSIC_Play(MUSIC_STARTUP); // if no splash page startup msg is used force playing here #endif GUI_HandleButtons(1); MIXER_Init(); PAGE_Init(); CLOCK_StartWatchdog(); #if HAS_DATALOG DATALOG_Init(); #endif priority_ready = 0; CLOCK_SetMsecCallback(LOW_PRIORITY, LOW_PRIORITY_MSEC); CLOCK_SetMsecCallback(MEDIUM_PRIORITY, MEDIUM_PRIORITY_MSEC); // We need to wait until we've actually measured the ADC before proceeding while(! (priority_ready & (1 << LOW_PRIORITY))) ; //Only do this after we've initialized all channel data so the saftey works PROTOCOL_InitModules(); GUI_DrawScreen(); #ifdef HAS_EVENT_LOOP start_event_loop(); #else while(1) { if(priority_ready) { EventLoop(); } //This does not appear to have any impact on power //and has been disabled in common/devo/power.c //but it helps a huge amount for the emulator PWR_Sleep(); } #endif }
int main() { Init(); #ifndef MODULAR //Banner(); #endif if(PWR_CheckPowerSwitch()) PWR_Shutdown(); LCD_Clear(0x0000); #ifdef TEST_ADC ADC_ScanChannels(); while(1); #endif u32 buttons = ScanButtons(); if(CHAN_ButtonIsPressed(buttons, BUT_ENTER) || !FS_Mount(NULL, NULL)) { LCD_DrawUSBLogo(LCD_WIDTH, LCD_HEIGHT); USB_Connect(); LCD_Clear(0x0000); FS_Mount(NULL, NULL); } CONFIG_LoadTx(); SPI_ProtoInit(); CONFIG_ReadDisplay(); CONFIG_ReadModel(CONFIG_GetCurrentModel()); CONFIG_ReadLang(Transmitter.language); BACKLIGHT_Brightness(Transmitter.brightness); LCD_Contrast(Transmitter.contrast); LCD_SetFont(DEFAULT_FONT.font); LCD_SetFontColor(DEFAULT_FONT.font_color); MUSIC_Play(MUSIC_STARTUP); GUI_HandleButtons(1); MIXER_Init(); PAGE_Init(); CLOCK_StartWatchdog(); #if DATALOG_ENABLED DATALOG_Init(); #endif priority_ready = 0; CLOCK_SetMsecCallback(LOW_PRIORITY, LOW_PRIORITY_MSEC); CLOCK_SetMsecCallback(MEDIUM_PRIORITY, MEDIUM_PRIORITY_MSEC); // We need to wait until we've actually measured the ADC before proceeding while(! (priority_ready & (1 << LOW_PRIORITY))) ; //Only do this after we've initialized all channel data so the saftey works PROTOCOL_Init(0); GUI_DrawScreen(); #ifdef HAS_EVENT_LOOP start_event_loop(); #else while(1) { if(priority_ready) { EventLoop(); } //PWR_Sleep(); //This does not appear to have any impact on power } #endif }
int main(int argc, char **argv) { int ncmds, i; const char *tmp; pgm_error_t *pgm_err = NULL; /* FIXME */ signal(SIGPIPE, SIG_IGN); setup_signal_handlers(); cmds = table_new(cmpstr, hashmurmur2, NULL, NULL); ncmds = sizeof commands / sizeof (struct cmd); for (i = 0; i < ncmds; ++i) { struct cmd *cmd = commands + i; table_insert(cmds, cmd->name, cmd); } if (argc != 2 && argc != 3) usage(); else if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) usage(); else if (argc == 3 && strcmp(argv[1], "-f")) usage(); if (argc == 2 && daemon(1, 0) == -1) fprintf(stderr, "Error daemonizing: %s\n", strerror(errno)); /* FIXME */ if (init_logger("/var/log/xcb/xcb-dp2.log", __LOG_DEBUG) == -1) { fprintf(stderr, "Error initializing logger\n"); exit(1); } cfg_path = argc == 2 ? argv[1] : argv[2]; if ((cfg = config_load(cfg_path)) == NULL) exit(1); if ((tmp = variable_retrieve(cfg, "general", "log_level"))) { if (!strcasecmp(tmp, "info")) set_logger_level(__LOG_INFO); else if (!strcasecmp(tmp, "notice")) set_logger_level(__LOG_NOTICE); else if (!strcasecmp(tmp, "warning")) set_logger_level(__LOG_WARNING); } /* FIXME */ if (addms) times = table_new(cmpstr, hashmurmur2, kfree, vfree); clients_to_close = dlist_new(NULL, NULL); clients = dlist_new(NULL, NULL); monitors = dlist_new(NULL, NULL); tp = thrpool_new(16, 512, 200, NULL); if (!pgm_init(&pgm_err)) { xcb_log(XCB_LOG_ERROR, "Error starting PGM engine: %s", pgm_err->message); pgm_error_free(pgm_err); goto err; } /* FIXME */ if (NEW(pgm_send_cfg) == NULL) { xcb_log(XCB_LOG_ERROR, "Error allocating memory for PGM cfg"); goto err; } pgm_send_cfg->network = NULL; pgm_send_cfg->port = 0; init_pgm_send_cfg(pgm_send_cfg); if (pgm_send_cfg->network == NULL) { xcb_log(XCB_LOG_ERROR, "PGM network can't be NULL"); goto err; } if (pgm_send_cfg->port == 0) { xcb_log(XCB_LOG_ERROR, "PGM port can't be zero"); goto err; } if ((pgm_sender = pgmsock_create(pgm_send_cfg->network, pgm_send_cfg->port, PGMSOCK_SENDER)) == NULL) goto err; /* FIXME */ if ((el = create_event_loop(1024 + 1000)) == NULL) { xcb_log(XCB_LOG_ERROR, "Error creating event loop"); goto err; } create_time_event(el, 1, server_cron, NULL, NULL); if ((tmp = variable_retrieve(cfg, "general", "udp_port")) && strcmp(tmp, "")) { if ((udpsock = net_udp_server(NULL, atoi(tmp), neterr, sizeof neterr)) == -1) { xcb_log(XCB_LOG_ERROR, "Opening port '%s': %s", tmp, neterr); goto err; } if (net_nonblock(udpsock, neterr, sizeof neterr) == -1) { xcb_log(XCB_LOG_ERROR, "Setting port '%s' nonblocking: %s", tmp, neterr); goto err; } } if ((tmp = variable_retrieve(cfg, "general", "tcp_port")) && strcmp(tmp, "")) if ((tcpsock = net_tcp_server(NULL, atoi(tmp), neterr, sizeof neterr)) == -1) { xcb_log(XCB_LOG_ERROR, "Opening port '%s': %s", tmp, neterr); goto err; } if (udpsock > 0 && create_file_event(el, udpsock, EVENT_READABLE, read_quote, NULL) == -1) { xcb_log(XCB_LOG_ERROR, "Unrecoverable error creating udpsock '%d' file event", udpsock); goto err; } if (tcpsock > 0 && create_file_event(el, tcpsock, EVENT_READABLE, tcp_accept_handler, NULL) == -1) { xcb_log(XCB_LOG_ERROR, "Unrecoverable error creating tcpsock '%d' file event", tcpsock); goto err; } xcb_log(XCB_LOG_NOTICE, "Server dispatcher started"); start_event_loop(el, ALL_EVENTS); delete_event_loop(el); pgm_shutdown(); return 0; err: close_logger(); exit(1); }
int main() { Init(); #ifndef ENABLE_MODULAR //Banner(); #endif if(PWR_CheckPowerSwitch()) PWR_Shutdown(); LCD_Clear(0x0000); #ifdef TEST_ADC ADC_ScanChannels(); while(1); #endif u32 buttons = ScanButtons(); if (CHAN_ButtonIsPressed(buttons, BUT_ENTER) || !FS_Init()) { LCD_DrawUSBLogo(LCD_WIDTH, LCD_HEIGHT); USB_Connect(); LCD_Clear(0x0000); FS_Init(); } CONFIG_LoadTx(); SPI_ProtoInit(); CONFIG_ReadDisplay(); CONFIG_ReadModel(CONFIG_GetCurrentModel()); CONFIG_ReadLang(Transmitter.language); BACKLIGHT_Brightness(Transmitter.backlight); LCD_Contrast(Transmitter.contrast); LCD_SetFont(DEFAULT_FONT.font); LCD_SetFontColor(DEFAULT_FONT.font_color); GUI_HandleButtons(1); MIXER_Init(); PAGE_Init(); CLOCK_StartWatchdog(); #if HAS_DATALOG DATALOG_Init(); #endif priority_ready = 0; CLOCK_SetMsecCallback(LOW_PRIORITY, LOW_PRIORITY_MSEC); CLOCK_SetMsecCallback(MEDIUM_PRIORITY, MEDIUM_PRIORITY_MSEC); // We need to wait until we've actually measured the ADC before proceeding while(! (priority_ready & (1 << LOW_PRIORITY))) PWR_Sleep(); //Only do this after we've initialized all channel data so the saftey works PROTOCOL_InitModules(); GUI_DrawScreen(); // Add startup delay to make sure audio player is initialized // AUDIO_Init() has already been called by CONFIG_ReadModel() #if HAS_EXTENDED_AUDIO audio_queue_time = CLOCK_getms() + 1500; num_audio=1; next_audio=1; #if (LCD_WIDTH == 480) || (LCD_WIDTH == 320) if(Display.background.drawn_background) while(CLOCK_getms() < audio_queue_time - 1200); #endif AUDIO_SetVolume(); // Initial setting of voice volume #endif MUSIC_Play(MUSIC_STARTUP); #ifdef HAS_EVENT_LOOP start_event_loop(); #else while(1) { if(priority_ready) { EventLoop(); } //This does not appear to have any impact on power //and has been disabled in common/devo/power.c //but it helps a huge amount for the emulator PWR_Sleep(); } #endif }