static int help_handler(cmd_data_t *cmd, int num, void *context) { ddns_t *ctx = (ddns_t *)context; (void)cmd; (void)num; if (ctx == NULL) return RC_INVALID_POINTER; ctx->abort = 1; print_help_page(); return 0; }
static RC_TYPE help_handler(CMD_DATA *p_cmd, int current_nr, void *p_context) { DYN_DNS_CLIENT *p_self = (DYN_DNS_CLIENT *)p_context; (void)p_cmd; (void)current_nr; if (p_self == NULL) { return RC_INVALID_POINTER; } p_self->abort = TRUE; print_help_page(); return RC_OK; }
/* MAIN - Dyn DNS update entry point.*/ int inadyn_main(int argc, char* argv[]) { RC_TYPE rc = RC_OK; DYN_DNS_CLIENT *p_dyndns = NULL; do { /* create DYN_DNS_CLIENT object */ rc = dyn_dns_construct(&p_dyndns); if (rc != RC_OK) { break; } rc = dyn_dns_main(p_dyndns, argc, argv); } while(0); /* end of program */ if (rc != 0) { print_help_page(); /* log error*/ DBG_PRINTF((LOG_WARNING,"W:" MODULE_TAG "Main: Error '%s' (0x%x).\n", errorcode_get_name(rc), rc)); } /* destroy DYN_DNS_CLIENT object*/ rc = dyn_dns_destruct(p_dyndns); if (rc != RC_OK) { DBG_PRINTF((LOG_WARNING,"W:" MODULE_TAG "Main: Error '%s' (0x%x) in dyn_dns_destruct().\n", errorcode_get_name(rc), rc)); } os_close_dbg_output(); return (int) rc; }
void help(void *fonts) { FontSet *fontset = (FontSet *)fonts; u8 page = 0; touchPosition stylus; Canvas buffer_top(SCREEN_WIDTH, SCREEN_HEIGHT); Canvas buffer_bottom(SCREEN_WIDTH, SCREEN_HEIGHT); Button button_prev(&screen_bottom, fontset->large_font, "<<"); Button button_next(&screen_bottom, fontset->large_font, ">>"); Button button_back(&screen_bottom, fontset->large_font, "Back"); button_prev.set_colors(BUTTON_COLORS, BUTTON_PRESSED_COLORS); button_next.set_colors(BUTTON_COLORS, BUTTON_PRESSED_COLORS); button_back.set_colors(BUTTON_COLORS, BUTTON_PRESSED_COLORS); button_prev.set_width(32); button_next.set_width(32); button_back.set_width(SCREEN_WIDTH - 84); button_prev.set_height(32); button_next.set_height(32); button_back.set_height(32); button_prev.set_position(5, SCREEN_HEIGHT - 37); button_next.set_position(SCREEN_WIDTH - 37, SCREEN_HEIGHT - 37); button_back.set_position(42, SCREEN_HEIGHT - 37); print_help_page((FontSet *)fonts, page, &buffer_top, &buffer_bottom); buffer_top.copy(&screen_top); buffer_bottom.copy(&screen_bottom); button_prev.disable(); button_prev.draw(); button_next.draw(); button_back.draw(); while (1) { scanKeys(); touchRead(&stylus); if (button_prev.update(stylus) == BUTTON_CLICKED) { if (page > 0) { page--; print_help_page((FontSet *)fonts, page, &buffer_top, &buffer_bottom); buffer_top.copy(&screen_top); buffer_bottom.copy(&screen_bottom); if (page == 0) { button_prev.disable(); } button_next.enable(); button_prev.draw(); button_next.draw(); button_back.draw(); } } if (button_next.update(stylus) == BUTTON_CLICKED) { if (page < NUM_PAGES - 1) { page++; print_help_page((FontSet *)fonts, page, &buffer_top, &buffer_bottom); buffer_top.copy(&screen_top); buffer_bottom.copy(&screen_bottom); if (page == NUM_PAGES - 1) { button_next.disable(); } button_prev.enable(); button_prev.draw(); button_next.draw(); button_back.draw(); } } if (button_back.update(stylus) == BUTTON_CLICKED) { break; } swiWaitForVBlank(); } // Load title screen Image image_title(&screen_top, options.full_path("images/title.img")); image_title.draw(0, 0); }
static void parse_command_option(gint argc, gchar **argv) { if(argc<2 || g_strcmp0("help", argv[1])==0){ print_help_page(); }else{ if(g_strcmp0("list", argv[1])==0){ case_tree_init(); if(argc==2){ qa_frame_print_case_list(); }else if(argc==3){ qa_frame_print_case_list_by_ID(argv[2]); }else print_help_page(); }else if(g_strcmp0("random", argv[1])==0){ int i=2; while(i<argc){ if(g_strcmp0("-t", argv[i])==0){ if((i+1)<argc && g_ascii_isdigit(argv[i+1][0])) g_sys_state.uiMaxSteps = ((guint)g_ascii_strtod(argv[i+1], NULL)); else{ printf("Bad parameter for '-t' option.\n"); g_sys_state.uiMaxSteps = 0; break; } i = i+2; }else if(g_strcmp0("-r", argv[i])==0){ if((i+1)<argc && g_ascii_isdigit(argv[i+1][0])) g_sys_state.uiRandSeed = ((guint)g_ascii_strtod(argv[i+1], NULL)); else{ printf("Bad parameter for '-r' option.\n"); g_sys_state.uiRandSeed = 0; break; } i = i+2; }else if(g_ascii_isdigit(argv[i][0])){ case_tree_init(); parse_case_ids(argv[i]); break; }else{ printf("Bad parameters. see manual page.\n"); break; } } if(g_sys_state.pCurModule!=NULL && g_sys_state.uiMaxSteps>0 && g_sys_state.uiRandSeed>0) random_run(); else printf("Bad parameters.\n"); }else if(g_strcmp0("all", argv[1])==0){ int priority=CASE_WEIGHT_P1|CASE_WEIGHT_P2|CASE_WEIGHT_P3; if(argc==4 && g_strcmp0("-priority", argv[2])==0){ if(g_strcmp0("P1", argv[3])==0 || g_strcmp0("p1", argv[3])==0) priority = CASE_WEIGHT_P1; else if(g_strcmp0("P2", argv[3])==0 || g_strcmp0("p2", argv[3])==0) priority = CASE_WEIGHT_P2; else if(g_strcmp0("P3", argv[3])==0 || g_strcmp0("p3", argv[3])==0) priority = CASE_WEIGHT_P3; else{ printf("The parameters of priority is bad, see manual page.\n"); return; } } printf("START ===[MCA_TS]===\n[test_bed][MCA_TS][Init][starting MCA_TS][end]\n"); case_tree_init(); qa_frame_run_all_cases(priority); printf("END ====[MCA_TS]=====\n[test_bed][MCA_TS][Exit][O_tb_exit()][end]\n"); }else{ int priority=CASE_WEIGHT_P1|CASE_WEIGHT_P2|CASE_WEIGHT_P3; if(argc==4 && g_strcmp0("-priority", argv[2])==0){ if(g_strcmp0("P1", argv[3])==0 || g_strcmp0("p1", argv[3])==0) priority = CASE_WEIGHT_P1; else if(g_strcmp0("P2", argv[3])==0 || g_strcmp0("p2", argv[3])==0) priority = CASE_WEIGHT_P2; else if(g_strcmp0("P3", argv[3])==0 || g_strcmp0("p3", argv[3])==0) priority = CASE_WEIGHT_P3; else{ printf("The parameters of priority is bad, see manual page.\n"); return; } } QA_PRINT(3, ("priority=%d", priority)); printf("START ===[MCA_TS]===\n[test_bed][MCA_TS][Init][starting MCA_TS][end]\n"); case_tree_init(); qa_frame_run_case_by_list(argv[1], priority); printf("END ====[MCA_TS]=====\n[test_bed][MCA_TS][Exit][O_tb_exit()][end]\n"); } } }