/*---------------------------------------------------------------------------*/ void telnetd_quit(void) { shell_quit(); #if TELNETD_CONF_GUI telnetd_gui_quit(); #endif /* TELNETD_CONF_GUI */ process_exit(&telnetd_process); LOADER_UNLOAD(); }
/*---------------------------------------------------------------------------*/ void shell_input(char *cmd) { char *buff; //parse(cmd, parsetab); if(!strcmp(cmd,"quit")) shell_quit(cmd); else { CLI_Builder(cmd, buff); shell_output(buff,"\n"); shell_prompt(CLI_PROMPT); } }
/*-----------------------------------------------------------------------------------*/ PROCESS_THREAD(shell_gui_process, ev, data) { PROCESS_BEGIN(); ctk_window_new(&window, SHELL_GUI_XSIZE, SHELL_GUI_YSIZE + 1, "Command shell"); CTK_WIDGET_ADD(&window, &loglabel); /* CTK_WIDGET_SET_FLAG(&loglabel, CTK_WIDGET_FLAG_MONOSPACE);*/ CTK_WIDGET_ADD(&window, &commandentry); /* CTK_WIDGET_SET_FLAG(&commandentry, CTK_WIDGET_FLAG_MONOSPACE);*/ CTK_WIDGET_FOCUS(&window, &commandentry); shell_init(); shell_file_init(); shell_ps_init(); shell_run_init(); shell_text_init(); shell_time_init(); shell_wget_init(); ctk_window_open(&window); while(1) { PROCESS_WAIT_EVENT(); if(ev == ctk_signal_widget_activate && data == (process_data_t)&commandentry) { int command_len = (int)strlen(command); shell_default_output("> ", 2, command, command_len); shell_input(command, command_len); if(shell_gui_process.state) { CTK_TEXTENTRY_CLEAR(&commandentry); CTK_WIDGET_REDRAW(&commandentry); } } else if(ev == ctk_signal_window_close || ev == PROCESS_EVENT_EXIT) { shell_quit(); ctk_window_close(&window); process_exit(&shell_gui_process); LOADER_UNLOAD(); } } PROCESS_END(); }
/*-----------------------------------------------------------------------------------*/ static void execfile(char *str) { runfile(str); shell_quit(NULL); }