• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

Virtual machine Management Terminal User Interface


Commit MetaInfo

Revision52e9a543f94bb41c93cc3e508e82fa40360cf28d (tree)
Zeit2023-04-04 22:20:27
AutorKoine Yuusuke(koinec) <koinec@user...>
CommiterKoine Yuusuke(koinec)

Log Message

Improve Guest line output in VMlist window.

Ändern Zusammenfassung

Diff

--- a/src/tuivmlist.c
+++ b/src/tuivmlist.c
@@ -192,10 +192,14 @@ int
192192 VmList_Item *p_item;
193193 char str_fmt[32];
194194 char str_stat[16];
195+ char str_loader[32];
196+ char str_term[16];
195197 char *pstr_con;
196198 char *pstr_type;
199+ char *pstr_stat;
197200 char str_animation[5] = "-\\|/";
198201 chtype ch_line;
202+ KeyVal_Data t_kval;
199203
200204 i_err = TuiVmList_CreateList();
201205
@@ -284,27 +288,41 @@ int
284288
285289 switch( p_guest->dw_status ) {
286290 case GUEST_STATUS_STOP:
287- strncpy( str_stat, " Stop", 15 );
291+ pstr_stat = " Stop";
288292 i_attr = COLOR_PAIR(1); // White-Black
289293 break;
290294 case GUEST_STATUS_RUN:
291- strncpy( str_stat, "* RUN", 15 );
295+ pstr_stat = "* RUN";
292296 i_attr = COL_CYAN;
293297 break;
294298 case GUEST_STATUS_WAIT:
295- strncpy( str_stat, "- Wait", 15 );
299+ pstr_stat = "- Wait";
296300 i_attr = COL_YELLOW;
297301 break;
298302 case GUEST_STATUS_UNKNOWN:
299- strncpy( str_stat, "? UNKNOWN", 15 );
303+ pstr_stat = "? UNKNOWN";
300304 i_attr = COL_MAGENTA;
301305 break;
302306 default:
303- strncpy( str_stat, "! BUG!!", 15 );
307+ pstr_stat = "! BUG!!";
304308 i_attr = COL_RED;
305309 break;
306310 }
307311
312+ i_err = KeyVal_GetData( &t_kval, &(p_guest->t_info), GUEST_LOADER_LOADER_KEY );
313+ if( 0x00 == i_err )
314+ { strncpy( str_loader, KEYVAL_DATA_STRING( t_kval ), sizeof(str_loader) ); }
315+ else
316+ { strncpy( str_loader, "UNKNOWN", sizeof(str_loader) ); }
317+
318+ i_err = KeyVal_GetData( &t_kval, &(p_guest->t_info), GUEST_VNC_ENABLE_KEY );
319+ if(( 0x00 == i_err ) && KEYVAL_DATA_ISBOOL( t_kval ) )
320+ { strncpy( str_term, "[VNC/", sizeof(str_term) ); }
321+ else
322+ { strncpy( str_term, "[---/", sizeof(str_term) ); }
323+ // XXX
324+ strncat( str_term, "---/---]", sizeof(str_term) - 5 );
325+
308326 if( gi_line_now == i_line )
309327 { wattrset( gp_vmlist_win, i_attr | A_REVERSE ); }
310328 else
@@ -312,9 +330,10 @@ int
312330
313331 // Indent(2) + HyperName&fqdn(48+) + ConnectType(16) + State(10)
314332 // ConnectType: "Local", "SSH(vmbhyve)
315- snprintf( str_fmt, 32, " %%-%d.%ds %%-16s %%-14s",
316- (COLS - 4 - 16 - 14 - 2 - 2) , (COLS - 4 - 16 - 14 - 2 - 2) );
317- mvwprintw( gp_vmlist_win, i_line, 1, str_fmt, p_guest->str_vmname, "type", str_stat );
333+ snprintf( str_fmt, 32, " %%-%d.%ds %%-16s %%-16s %%-14s",
334+ (COLS - 4 -1 -16 -1 -16 -1 -14 -2) , (COLS -4 -1 -16 -1 -16 -1 -14 -2) );
335+ mvwprintw( gp_vmlist_win, i_line, 1, str_fmt,
336+ p_guest->str_vmname, str_loader, str_term, pstr_stat );
318337
319338 Guest_Release( p_guest );
320339