📄 panelprocs.c
字号:
(void)panel_set(printer_name_item, PANEL_VALUE, (tmp=getenv("PRINTER"))!=NULL?tmp:"lp", 0);}/****************************************************************************** * Panel notify procedure for the "Done" button item in "System Options" * * popup subwindow. * ******************************************************************************/static option_done_proc(){ core_file = (int)panel_get_value(core_item); single_pass = (int)panel_get_value(single_item); quick_test = (int)panel_get_value(quick_item); verbose = (int)panel_get_value(verbose_item); trace = (int)panel_get_value(trace_item); auto_start = (int)panel_get_value(auto_item); run_error = (int)panel_get_value(run_error_item); max_sys_pass = atoi(panel_get_value(max_passes_item)); max_errors = atoi(panel_get_value(max_errors_item)); max_tests = atoi(panel_get_value(max_tests_item)); send_email = (int)panel_get_value(email_item); log_period = atoi(panel_get_value(log_period_item)); (void)strcpy(eaddress, panel_get_value(address_item)); (void)strcpy(printer_name, panel_get_value(printer_name_item)); set_max_tests(max_tests); /* set the max. # of tests per group */ (void)window_set(o_frame, FRAME_NO_CONFIRM, TRUE, 0); (void)window_destroy(o_frame); o_frame = NULL;}/****************************************************************************** * Notify procedure for the "Print Screen" button. * ******************************************************************************/static int fork_object;static int *fork_handle = &fork_object;/*ARGSUSED*/pscrn_proc(){ char buff[162]; int pid; (void)sprintf(buff, "./diagscrnprnt %s",printer_name); if ((pid=vfork()) == 0) /* child */ { (void)execl("/bin/csh", "csh", "-c", buff, (char *)0); _exit(127); } if (pid != -1) /* succeeded */ (void)notify_set_wait3_func((Notify_client)fork_handle, notify_default_wait3, pid);}/****************************************************************************** * Notify procedure for the "Suspend" button. * ******************************************************************************//*ARGSUSED*/suspend_proc(){ int test_id; disable_batch(); /* disable batch processing for now */ if (running != GO) { (void)confirm("Can't suspend unless tests are running!", TRUE); return; } running = SUSPEND; for (test_id=0; test_id != exist_tests; ++test_id) { if (tests[test_id]->pid != 0) /* it is running */ (void)kill(tests[test_id]->pid, SIGSTOP); } elapse_count += (int)time((time_t *)0) - last_elapse; /* increment the elapsed seconds */ (void)time_display(); /* display elapse time on status subwindow */ if (!tty_mode) { (void)panel_set(reset_item, PANEL_LABEL_IMAGE, resume_button, PANEL_NOTIFY_PROC, resume_proc, 0); light_all_buttons(); } status_display();}/****************************************************************************** * Notify procedure for the "Resume" button. * ******************************************************************************//*ARGSUSED*/resume_proc(){ int test_id; disable_batch(); /* disable batch processing for now */ if (running != SUSPEND) { (void)confirm("Can't resume unless tests are suspended!", TRUE); return; } for (test_id=0; test_id != exist_tests; ++test_id) { if (tests[test_id]->pid != 0) /* it is loaded */ (void)kill(tests[test_id]->pid, SIGCONT); } last_elapse = (int)time((time_t *)0); /* get current time of the day */ running = GO; if (!tty_mode) { if (o_frame != NULL) /* close the system option popup if it was opened */ frame_destroy_proc(o_frame); if (of_frame != NULL) /* close the option file popup if it was opened */ frame_destroy_proc(of_frame); (void)panel_set(reset_item, PANEL_LABEL_IMAGE, suspend_button, PANEL_NOTIFY_PROC, suspend_proc, 0); gray_all_buttons(); } status_display();}/****************************************************************************** * Notify procedure for the "Quit" button. * ******************************************************************************/quit_proc(){ (void)window_destroy(sundiag_frame); /* quit sundiag */}/****************************************************************************** * Notify procedure for the "Intervention" cycle. * ******************************************************************************//***** global variables *****/int intervention=0;/*ARGSUSED*/interven_proc(item, value, event)Panel_item item;int value;Event *event;{ int test_id, group_id, id; int update_flag=0; intervention = value; if (tty_mode) tty_int_sel(); if (intervention) /* enable the intervention mode */ { for (test_id=0; test_id != exist_tests; ++test_id) if (tests[test_id]->type == 2) { tests[test_id]->type = 12; /* enable the tests */ if ((tests[test_id]->dev_enable && tests[test_id]->enable) || (tests[test_id]->dev_enable && tests[test_id]->test_no != 1)) { if (tests[test_id]->which_test == 1) { if (!tty_mode) { (void)panel_set(groups[tests[test_id]->group].select, PANEL_TOGGLE_VALUE, 0, TRUE, 0); (void)panel_set(tests[test_id]->select, PANEL_TOGGLE_VALUE, 0, TRUE, 0); (void)panel_set(select_item, PANEL_FEEDBACK, PANEL_NONE, 0); /* no slection mark */ } else display_enable(test_id, TRUE); selection_flag = FALSE; } update_flag = 1; } } } else { for (test_id=0; test_id != exist_tests; ++test_id) if (tests[test_id]->type == 12) { tests[test_id]->type = 2; /* disable the tests */ if (tests[test_id]->pid != 0) /* test is currently running */ (void)kill(tests[test_id]->pid, SIGINT); /* kill it */ if ((tests[test_id]->dev_enable && tests[test_id]->enable) || (tests[test_id]->dev_enable && tests[test_id]->test_no != 1)) { if (tests[test_id]->which_test == 1) if (!tty_mode) (void)panel_set(tests[test_id]->select, PANEL_TOGGLE_VALUE, 0, FALSE, 0); else display_enable(test_id, FALSE); update_flag = 1; group_id = tests[test_id]->group; id = groups[group_id].first; for (; id != exist_tests; ++id) { if (tests[id]->group != group_id) /* none was enabled */ if (!tty_mode) (void)panel_set(groups[group_id].select, PANEL_TOGGLE_VALUE, 0, FALSE, 0); if (tests[id]->enable && tests[id]->type != 2) /* at least one is enabled */ break; /* done */ } if (id == exist_tests) /* none was enabled */ (void)panel_set(groups[group_id].select, PANEL_TOGGLE_VALUE, 0, FALSE, 0); } } } if (!ats_nohost) (void)panel_set(mode_item, PANEL_VALUE, intervention, 0); /* update the cycle on the screen too */ if (update_flag) print_status(); /* update status panel also */}/****************************************************************************** * Notify procedure for the "Test selections" toggle. * ******************************************************************************//***** global variables *****/int select_value=SEL_DEF; /* default to Default(SEL_DEF) *//*ARGSUSED*/select_proc(item, value, event)Panel_item item;int value;Event *event;{ int test_id, group_id; int tmp; select_value = value; if (!tty_mode) { if (option_frame != NULL) /* destroy the popup test option frame */ frame_destroy_proc(option_frame); (void)panel_set(select_item, PANEL_FEEDBACK, PANEL_INVERTED, 0); } else tty_int_sel(); /* update the control panel */ selection_flag = TRUE; switch (value) { case SEL_DEF: /* disable all the tests first */ group_id = -1; /* initialize the id(to flag the first group) */ for (test_id=0; test_id != exist_tests; ++test_id) { if (tests[test_id]->type == 2) continue; /* skip this */ if (group_id != tests[test_id]->group) /* clear the group too */ { group_id = tests[test_id]->group; /* save it for next */ groups[group_id].enable = FALSE; if (!tty_mode) (void)panel_set(groups[group_id].select, PANEL_TOGGLE_VALUE, 0, FALSE, 0); } tests[test_id]->enable = FALSE; if (tests[test_id]->test_no > 1) { tests[test_id]->dev_enable = FALSE; if (tests[test_id]->which_test > 1) continue; } if (!tty_mode) (void)panel_set(tests[test_id]->select, PANEL_TOGGLE_VALUE, 0, FALSE, 0); else display_enable(test_id, FALSE); } for (test_id=0; test_id != exist_tests; ++test_id) { if (tests[test_id]->type == 0) /* this is a default test */ { group_id = tests[test_id]->group; if (!groups[group_id].enable) { groups[group_id].enable = TRUE; if (!tty_mode) (void)panel_set(groups[group_id].select, PANEL_TOGGLE_VALUE, 0, TRUE, 0); } tests[test_id]->enable = TRUE; if (tests[test_id]->test_no > 1) { tests[test_id]->dev_enable = TRUE; for (tmp=test_id; tests[tmp]->which_test != 1; --tmp); if (!tty_mode) (void)panel_set(tests[tmp]->select, PANEL_TOGGLE_VALUE, 0, TRUE, 0); else display_enable(tmp, TRUE); } else { if (!tty_mode) (void)panel_set(tests[test_id]->select, PANEL_TOGGLE_VALUE, 0, TRUE, 0); else display_enable(test_id, TRUE); } } } if (running == GO) { for (test_id=0; test_id != exist_tests; ++test_id) if ((!tests[test_id]->enable) && tests[test_id]->pid != 0) (void)kill(tests[test_id]->pid, SIGINT); } print_status(); break; case SEL_NON: group_id = -1; /* initialize the id(to flag the first group) */ for (test_id=0; test_id != exist_tests; ++test_id) { if (tests[test_id]->type == 2) continue; /* skip this */ if (group_id != tests[test_id]->group) /* clear the group too */ { group_id = tests[test_id]->group; /* save it for next */ groups[group_id].enable = FALSE; if (!tty_mode) (void)panel_set(groups[group_id].select, PANEL_TOGGLE_VALUE, 0, FALSE, 0); } tests[test_id]->enable = FALSE; if (tests[test_id]->test_no > 1) { tests[test_id]->dev_enable = DISABLE; if (tests[test_id]->which_test == 1) if (!tty_mode) (void)panel_set(tests[test_id]->select, PANEL_TOGGLE_VALUE, 0, FALSE, 0); else display_enable(test_id, FALSE); } else { if (!tty_mode) (void)panel_set(tests[test_id]->select, PANEL_TOGGLE_VALUE, 0, FALSE, 0); else display_enable(test_id, FALSE); } if (tests[test_id]->pid != 0) (void)kill(tests[test_id]->pid, SIGINT); } print_status(); break; case SEL_ALL: group_id = -1; /* initialize the id(to flag the first group) */ for (test_id=0; test_id != exist_tests; ++test_id) { if (tests[test_id]->type == 2) continue; /* skip this */ if (group_id != tests[test_id]->group) /* set the group too */ { group_id = tests[test_id]->group; /* save it for next */ groups[group_id].enable = TRUE; (void)panel_set(groups[group_id].select, PANEL_TOGGLE_VALUE, 0, TRUE, 0); } tests[test_id]->enable = TRUE; if (tests[test_id]->test_no > 1) { tests[test_id]->dev_enable = ENABLE; if (tests[test_id]->which_test == 1) if (!tty_mode) (void)panel_set(tests[test_id]->select, PANEL_TOGGLE_VALUE, 0, TRUE, 0); else display_enable(test_id, TRUE); } else { if (!tty_mode) (void)panel_set(tests[test_id]->select, PANEL_TOGGLE_VALUE, 0, TRUE, 0); else display_enable(test_id, TRUE); } } print_status(); /* display them */ break; default: break; }}/****************************************************************************** * Destroys the frame without comfirmer, also is the FRAME_DONE_PROC for * * some frames that like to be destroyed without confirmer. * * Input: done_frame, the handle of the frame to be destroyed. * ******************************************************************************/frame_destroy_proc(done_frame)Frame done_frame;{ (void)window_set(done_frame, FRAME_NO_CONFIRM, TRUE, 0); (void)window_destroy(done_frame); if (done_frame == o_frame) o_frame = NULL; else if (done_frame == of_frame) of_frame = NULL; else if (done_frame == option_frame) option_frame = NULL;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -