• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Virtual machine Management Terminal User Interface


コミットメタ情報

リビジョンf7c11dcbc54747e375aab66654d9c101669c6996 (tree)
日時2023-04-03 22:53:05
作者Koine Yuusuke(koinec) <koinec@user...>
コミッターKoine Yuusuke(koinec)

ログメッセージ

Implemented exec. serial console with external terminal.

変更サマリ

差分

--- a/src/localexec.c
+++ b/src/localexec.c
@@ -29,6 +29,70 @@
2929 #include "vmtui.h"
3030
3131 /* ===========================================================================*/
32+void
33+ LocalExec_Error(
34+ char *pstr_msg,
35+ char *pstr_argv[],
36+ int i_argc,
37+ int i_hvisor,
38+ int i_guest,
39+ int i_err )
40+{
41+ int i_len;
42+ int i_remain;
43+ int i_cnt;
44+ char str_buffer[512];
45+ char *pstr_now;
46+ char *pstr_temp = NULL;
47+
48+ memset( str_buffer, 0x00, sizeof( str_buffer ) );
49+
50+ pstr_now = str_buffer;
51+ i_remain = sizeof( str_buffer );
52+
53+ for( i_cnt = 0; i_cnt < i_argc; i_cnt++ ) {
54+ i_len = strnlen( pstr_argv[i_cnt], sizeof( str_buffer ) );
55+
56+ if( (i_cnt + 1) == i_argc ) {
57+ pstr_temp = pstr_argv[i_cnt];
58+ while(('\0' != *pstr_temp) && (' ' != *pstr_temp))
59+ { pstr_temp++; }
60+
61+ if( '\0' != *pstr_temp ) {
62+ *pstr_now++ = '\'';
63+ i_remain--;
64+
65+ *pstr_now = '\0';
66+ }
67+ }
68+
69+ strncat( pstr_now, pstr_argv[i_cnt], i_remain );
70+ i_remain -= i_len;
71+ pstr_now += i_len;
72+
73+ if( (i_cnt + 1) < i_argc ) {
74+ *pstr_now++ = ' ';
75+ i_remain--;
76+
77+ *pstr_now = '\0';
78+ }
79+ else {
80+ if( '\0' != *pstr_temp ) {
81+ *pstr_now++ = '\'';
82+ i_remain--;
83+
84+ *pstr_now = '\0';
85+ }
86+ }
87+ }
88+
89+ ErrInfo_Error( pstr_msg, i_hvisor, i_guest, REQUEST_ID_NONE,
90+ errno, i_err, 0x00, str_buffer );
91+
92+ return;
93+}
94+
95+/* ===========================================================================*/
3296 int
3397 LocalExec_ExecBackgroundCommand(
3498 char *pstr_argv[] )
@@ -256,10 +320,9 @@ int
256320 i_remain -= 4;
257321 pstr_now += 4;
258322
259- // XXX sudo option
260- /*
261- if( 0 < gt_openssh.option.i_len ) {
262- strncpy( str_option, gt_openssh.option.str_option, VMTUI_CMDINFO_MAXLEN_OPTION );
323+ // sudo option ---
324+ if( 0 < p_hvisor->sudo.option.i_len ) {
325+ strncpy( str_option, p_hvisor->sudo.option.str_option, VMTUI_CMDINFO_MAXLEN_OPTION );
263326
264327 pstr_next = str_option;
265328 while( NULL != (pstr_val = strsep( &pstr_next, " " ))) {
@@ -272,7 +335,6 @@ int
272335 }while( '\0' != *pstr_val++ );
273336 }
274337 }
275- */
276338 }
277339
278340 strncpy( pstr_now, VMBHYVE_DEFAULT_PATH, VMBHYVE_DEFAULT_PATH_LEN );
@@ -298,16 +360,13 @@ int
298360
299361 pstr_argv[i_argc] = NULL;
300362
301-ErrInfo_DebugMsg( "================================================" );
302-
303- {
304- int i_cnt;
305- for( i_cnt = 0; i_cnt < i_argc; i_cnt++ ) {
306- ErrInfo_DebugMsg( pstr_argv[i_cnt] );
307- }
308- }
309-
363+ // Exec.
310364 i_err = LocalExec_ExecBackgroundCommand( pstr_argv );
365+ if( 0x00 != i_err ) {
366+ LocalExec_Error(
367+ "Can't exec external serial-console.",
368+ pstr_argv, i_argc, i_hvisor, i_guest, i_err );
369+ }
311370
312371 return 0x00;
313372 }
--- a/src/tuivmlist_event.c
+++ b/src/tuivmlist_event.c
@@ -75,7 +75,7 @@ int
7575 int i_hvisor, int i_guest, int i_option )
7676 {
7777 LocalExec_ExecSerialTerminal_External( i_guest, 0x00 );
78- ErrInfo_DebugMsg( "Serial Console" );
78+
7979 return 0x00;
8080 }
8181