• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Virtual machine Management Terminal User Interface


Commit MetaInfo

Révision43237fdc034db19da2799ac0bb8d6b65cfd72ae3 (tree)
l'heure2022-07-24 19:47:45
AuteurKoine Yuusuke(koinec) <koinec@user...>
CommiterKoine Yuusuke(koinec)

Message de Log

Implement TuiKey Mode YesNo.

Change Summary

Modification

--- a/src/tuicmd.c
+++ b/src/tuicmd.c
@@ -39,23 +39,26 @@ int
3939 int i_mode;
4040 int i_len;
4141 char *pstr_input;
42+ char *pstr_prompt;
4243 char str_pass[ HVISOR_SSH_MAXLEN_PASSWORD ];
4344
4445 werase( gp_cmd_win );
4546
47+ pstr_prompt = TuiKey_GetPromptString();
48+
4649 i_mode = TuiKey_GetMode();
4750 if( TUIKEY_MODE_INPUTSTR == i_mode ) {
4851 pstr_input = TuiKey_GetInputStringAndPasswd( NULL );
49- mvwprintw( gp_cmd_win, 0, 0, "Input String => %s", pstr_input );
52+ mvwprintw( gp_cmd_win, 0, 0, "%s => %s", pstr_prompt, pstr_input );
5053 }
5154 else if( TUIKEY_MODE_INPUTPASSWD == i_mode ) {
5255 pstr_input = TuiKey_GetInputStringAndPasswd( &i_len );
5356 str_pass[ i_len-- ] = '\0';
5457 for( ; 0 <= i_len; i_len-- ) { str_pass[ i_len ] = '*'; }
55- mvwprintw( gp_cmd_win, 0, 0, "Input Password => %s", str_pass );
58+ mvwprintw( gp_cmd_win, 0, 0, "%s => %s", pstr_prompt, str_pass );
5659 }
5760 if( TUIKEY_MODE_VMLIST == i_mode ) {
58- mvwaddstr( gp_cmd_win, 0, 0, "Command Line" );
61+ mvwprintw( gp_cmd_win, 0, 0, "%s :", pstr_prompt );
5962 }
6063
6164 touchwin( gp_cmd_win );
--- a/src/tuikey.c
+++ b/src/tuikey.c
@@ -121,6 +121,15 @@ char *
121121
122122 /* ===========================================================================*/
123123 VMTUI_TUIKEY_EXTERN
124+char *
125+ TuiKey_GetPromptString(
126+ void )
127+{
128+ return gt_input.str_msg;
129+}
130+
131+/* ===========================================================================*/
132+VMTUI_TUIKEY_EXTERN
124133 int
125134 TuiKey_ChangeMode(
126135 int i_mode,
@@ -128,18 +137,35 @@ int
128137 int i_hvisor,
129138 int i_guest )
130139 {
131- if(( TUIKEY_MODE_INPUTSTR == i_mode ) || ( TUIKEY_MODE_INPUTPASSWD == i_mode )) {
132- gi_keymode = i_mode;
140+ gi_keymode = i_mode;
141+
142+ gt_input.b_reqcmd = b_reqcmd;
143+ gt_input.i_hvisor = i_hvisor;
144+ gt_input.i_guest = i_guest;
145+
146+ if( TUIKEY_MODE_INPUTSTR == i_mode ) {
133147 gt_input.i_inputlen = 0;
134148 gt_input.i_input = 0;
135149 gt_input.str_input[0] = '\0';
136-
137- gt_input.b_reqcmd = b_reqcmd;
138- gt_input.i_hvisor = i_hvisor;
139- gt_input.i_guest = i_guest;
150+ strncpy( gt_input.str_msg, "Input String", sizeof( gt_input.str_msg ) );
151+ }
152+ else if( TUIKEY_MODE_INPUTPASSWD == i_mode ) {
153+ gt_input.i_inputlen = 0;
154+ gt_input.i_input = 0;
155+ gt_input.str_input[0] = '\0';
156+ strncpy( gt_input.str_msg, "Input Password", sizeof( gt_input.str_msg ) );
157+ }
158+ else if( TUIKEY_MODE_YESNO == i_mode ) {
159+ strncpy( gt_input.str_msg, "Input 'Y'/'y'(YES) or OtherKey(No) ? ", sizeof( gt_input.str_msg ) );
140160 }
141161 else {
142162 gi_keymode = TUIKEY_MODE_VMLIST;
163+
164+ gt_input.b_reqcmd = REQUEST_CMD_NONE;
165+ gt_input.i_hvisor = HVISOR_ID_NONE;
166+ gt_input.i_guest = GUEST_ID_NONE;
167+
168+ strncpy( gt_input.str_msg, "Input Command", sizeof( gt_input.str_msg ) );
143169 }
144170
145171 return 0x00;
@@ -187,6 +213,22 @@ int
187213
188214 /* ===========================================================================*/
189215 int
216+ TuiKey_Dispatch_Mode_YesNo(
217+ int i_key )
218+{
219+ int i_ret = 0x00;
220+
221+ if(( 'Y' == i_key) || ( 'y' == i_key )) {
222+ ReqCtl_CreateRequest( gt_input.b_reqcmd, gt_input.i_hvisor, gt_input.i_guest, NULL );
223+ }
224+
225+ TuiKey_ChangeMode( TUIKEY_MODE_VMLIST, REQUEST_CMD_NONE, 0x00, 0x00 );
226+
227+ return i_ret;
228+}
229+
230+/* ===========================================================================*/
231+int
190232 TuiKey_Dispatch_VmList(
191233 int i_key )
192234 {
@@ -238,11 +280,7 @@ int
238280 break;
239281
240282 case 'i':
241- gi_keymode = TUIKEY_MODE_INPUTSTR;
242- refresh();
243- break;
244- case 'p':
245- gi_keymode = TUIKEY_MODE_INPUTPASSWD;
283+ //TuiKey_ChangeMode( TUIKEY_MODE_YESNO, REQUEST_ID_NONE,
246284 refresh();
247285 break;
248286 /*
@@ -279,6 +317,9 @@ int
279317 case TUIKEY_MODE_INPUTPASSWD:
280318 i_exit = TuiKey_Dispatch_Mode_InputStr( i_key );
281319 break;
320+ case TUIKEY_MODE_YESNO:
321+ i_exit = TuiKey_Dispatch_Mode_YesNo( i_key );
322+ break;
282323 default:
283324 break;
284325 }
@@ -302,9 +343,9 @@ int
302343
303344 curs_set(0);
304345
305- gi_keymode = TUIKEY_MODE_VMLIST;
306- gt_input.i_inputlen = 0;
307- gt_input.i_input = 0;
346+ memset( &gt_input, 0x00, sizeof( TuiKey_InputLine ) );
347+
348+ TuiKey_ChangeMode( TUIKEY_MODE_VMLIST, REQUEST_ID_NONE, HVISOR_ID_NONE, GUEST_ID_NONE );
308349
309350 return 0x00;
310351 }
--- a/src/tuikey.h
+++ b/src/tuikey.h
@@ -37,6 +37,7 @@
3737 #endif
3838 VMTUI_TUIKEY_EXTERN int TuiKey_GetMode( void );
3939 VMTUI_TUIKEY_EXTERN char *TuiKey_GetInputStringAndPasswd( int *pi_len );
40+VMTUI_TUIKEY_EXTERN char *TuiKey_GetPromptString( void );
4041 VMTUI_TUIKEY_EXTERN int TuiKey_ChangeMode( int i_mode, Byte b_reqcmd, int i_hvisor, int i_guest );
4142 VMTUI_TUIKEY_EXTERN int TuiKey_Dispatch( void );
4243 VMTUI_TUIKEY_EXTERN int TuiKey_Init( void );
@@ -45,6 +46,7 @@ VMTUI_TUIKEY_EXTERN int TuiKey_Term( void );
4546 #define TUIKEY_MODE_VMLIST 0x00
4647 #define TUIKEY_MODE_INPUTSTR 0x01
4748 #define TUIKEY_MODE_INPUTPASSWD 0x02
49+#define TUIKEY_MODE_YESNO 0x03
4850
4951 typedef struct {
5052 Byte b_reqcmd;
@@ -54,6 +56,8 @@ typedef struct {
5456 int i_inputlen;
5557 int i_input;
5658 char str_input[512];
59+ char str_option[512];
60+ char str_msg[128];
5761 } TuiKey_InputLine;
5862
5963 #ifdef VMTUI_SRC_TUIKEY