📄 mmsaprg.c
字号:
ST_INT chan;ST_CHAR temp [256]; if (!get_chan (&chan)) /* ask the user what channel to use */ { (*menu_set_fun) (); return; } /* build the request */ printf (" Enter program invocation name : (R) "); if (data_entered = strget (temp)) { temp[MAX_IDENT_LEN] = '\x00'; strcpy (info.piname,temp); } if (data_entered) { if (!mp_reset (chan,&info)) print_req_error (); if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; while (rep_count < num_reps) /* if enough done - */ { if (!mp_reset (chan,&info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } else wait_msg ("\n Must enter all required information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_kill *//* create and send a kill request. *//************************************************************************/ST_VOID do_kill (ST_VOID) {#if MMS_KILL_EN & REQ_ENKILL_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan;ST_CHAR temp [256]; if (!get_chan (&chan)) /* ask the user what channel to use */ { (*menu_set_fun) (); return; } /* build the request */ printf (" Enter program invocation name : (R) "); if (data_entered = strget (temp)) { temp[MAX_IDENT_LEN] = '\x00'; strcpy (info.piname,temp); } if (data_entered) { if (!mp_kill (chan,&info)) print_req_error (); if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; while (rep_count < num_reps) /* if enough done - */ { if (!mp_kill (chan,&info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } else wait_msg ("\n Must enter all required information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_getpi *//* create and send a get program invocation request. *//************************************************************************/ST_VOID do_getpi (ST_VOID) {#if MMS_GET_PI_EN & REQ_ENGETPI_REQ_INFO info;ST_BOOLEAN data_entered;ST_INT chan;ST_CHAR temp [256]; if (!get_chan (&chan)) /* ask the user what channel to use */ { (*menu_set_fun) (); return; } /* build the request */ printf (" Enter program invocation name : (R) "); if (data_entered = strget (temp)) { temp[MAX_IDENT_LEN] = '\x00'; strcpy (info.piname,temp); } if (data_entered) { if (!mp_getpi (chan,&info)) print_req_error (); if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; while (rep_count < num_reps) /* if enough done - */ { if (!mp_getpi (chan,&info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } else wait_msg ("\n Must enter all required information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_add_pi *//* Add a PI locally *//************************************************************************/ST_VOID do_add_pi (ST_VOID) {ST_CHAR *pi_name;ST_INT dom_count = 0;ST_CHAR **dname_ptr_list;ST_CHAR *dname_space_ptr; printf ("\n Enter program invocation name to add: (R) "); pi_name = dest_buffer; if (strget (pi_name)) { pi_name[MAX_IDENT_LEN] = '\x00'; dname_ptr_list = (ST_CHAR **)dest_buffer + 1024; dname_space_ptr = dest_buffer + 3072; printf (" Enter domain name : (R) "); while (strget (dname_space_ptr)) { *dname_ptr_list = dname_space_ptr; dname_ptr_list++; dom_count++; dname_space_ptr += strlen (dname_space_ptr) +1; printf (" Enter domain name : (R) "); } dname_ptr_list -= dom_count; /* pt back to beg of list */ if (ms_add_pi (pi_name, dom_count, dname_ptr_list, 0xff) == NULL) printf ("\nDidn't add %s to list of PI names", pi_name); else printf ("\n %s has been added to the list of PI names", pi_name); wait_msg (""); } (*menu_set_fun) (); }/************************************************************************//* do_del_pi *//* Delete a local PI *//************************************************************************/ST_VOID do_del_pi (ST_VOID) {ST_CHAR *pi_name; printf ("\n Enter program invocation name to delete: (R) "); pi_name = dest_buffer; if (strget (pi_name)) { pi_name[MAX_IDENT_LEN] = '\x00'; if (ms_del_pi (pi_name)) printf ("\nDidn't delete %s from list of PI names", pi_name); else printf ("\n %s has been deleted from the list of PI names", pi_name); wait_msg (""); } (*menu_set_fun) (); }/************************************************************************//* do_list_local_pis *//* List all the Program Invcations that this node has locally *//************************************************************************/ST_VOID do_list_local_pis (ST_VOID) {ST_INT chan;PROG_INV *ptr;NAMED_DOM_CTRL **dom_list_ptr;ST_INT i; if (!get_chan (&chan)) /* ask the user what channel to use */ { (*menu_set_fun) (); return; } CLEARSCR; ptr = m_vmd_select->prog_inv_list; /* start at head of dom list */ if (ptr == NULL) wait_msg ("\n There are no PI's in the Data Base"); else { if (ask ("\n Expand PI Description ? ",0)) { while (ptr != NULL) { CLEARSCR; printf ("\n Program Invocation: %s ", ptr->pi_name); printf ("\n Protected: "); if (ptr->protection) printf ("TRUE"); else printf ("FALSE"); printf ("\n Current State: "); print_pi_state (ptr->state); printf ("\n Deletable: "); if (ptr->deletable) printf ("TRUE"); else printf ("FALSE"); printf ("\n Reusable: "); if (ptr->reusable) printf ("TRUE"); else printf ("FALSE"); printf ("\n Monitor: "); if (ptr->monitor) printf ("TRUE"); else printf ("FALSE"); printf ("\n Start argument: "); if (ptr->start_arg) printf ("is pointing to something %d bytes long",ptr->start_len); else printf ("is NULL"); printf ("\n Number of domains in this PI: %d ", ptr->ndom); if (ptr-> ndom) { dom_list_ptr = (NAMED_DOM_CTRL **)(ptr + 1); for (i=0; i < ptr->ndom; i++, dom_list_ptr++) printf ("\n Dom [%d] is: %s", i, (*dom_list_ptr)->dom_name); } wait_msg (""); ptr = (PROG_INV *) list_get_next (m_vmd_select->prog_inv_list, ptr); } } else { printf ("\n Data Base of Program Invocations is:\n"); while (ptr != NULL) { printf ("\n Program Invocation: %s ", ptr->pi_name); ptr = (PROG_INV *) list_get_next (m_vmd_select->prog_inv_list, ptr); } wait_msg (""); } } (*menu_set_fun) (); }/************************************************************************//* do_change_pi_state *//* This one lets us transition the PI state for various testing needs *//************************************************************************/ST_VOID do_change_pi_state (ST_VOID) {ST_INT chan;PROG_INV *ptr;ST_CHAR *pi_name;ST_INT new_state; if (!get_chan (&chan)) /* ask the user what channel to use */ { (*menu_set_fun) (); return; } printf ("\n Enter program invocation name to change: (R) "); pi_name = dest_buffer; if (strget (pi_name)) { pi_name[MAX_IDENT_LEN] = '\x00'; if ((ptr = ms_find_pi (pi_name)) != NULL) { printf ("\n Current State: "); print_pi_state (ptr->state); printf ("\n %d - PI_NON_EXISTENT",PI_NON_EXISTENT); printf ("\n %d - PI_UNRUNNABLE",PI_UNRUNNABLE); printf ("\n %d - PI_IDLE",PI_IDLE); printf ("\n %d - PI_RUNNING",PI_RUNNING); printf ("\n %d - PI_STOPPED",PI_STOPPED); printf ("\n %d - PI_STARTING",PI_STARTING); printf ("\n %d - PI_STOPPING",PI_STOPPING); printf ("\n %d - PI_RESUMING",PI_RESUMING); printf ("\n %d - PI_RESETTING",PI_RESETTING); printf ("\n Enter new state: (R) "); if (intget (&new_state)) { if ((new_state >= PI_NON_EXISTENT) && (new_state <= PI_RESETTING)) { ptr->state = (ST_CHAR)new_state; printf ("\n Changed PI to state: "); print_pi_state (new_state); wait_msg (""); } /* not a good state to go to */ } /* did not enter a new PI state */ } /* could not find a PI with that name */ } /* no PI name */ (*menu_set_fun) (); }/************************************************************************//* print_pi_state *//* Debugging pi state changes is the worst. This prints out what the *//* number means *//************************************************************************/ST_VOID print_pi_state (ST_INT state) { switch (state) { case PI_NON_EXISTENT : printf ("PI_NON_EXISTENT"); break; case PI_UNRUNNABLE : printf ("PI_UNRUNNABLE"); break; case PI_IDLE : printf ("PI_IDLE"); break; case PI_RUNNING : printf ("PI_RUNNING"); break; case PI_STOPPED : printf ("PI_STOPPED"); break; case PI_STARTING : printf ("PI_STARTING"); break; case PI_STOPPING : printf ("PI_STOPPING"); break; case PI_RESUMING : printf ("PI_RESUMING"); break; case PI_RESETTING : printf ("PI_RESETTING"); break; default : /* any other error reason */ printf ("UNDEFINED PI STATE"); break; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -