+ hostname display on ncurses header bar
This commit is contained in:
父節點
ed0b1ffa25
當前提交
c848ebd12d
|
@ -1,6 +1,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
|
@ -24,9 +26,10 @@ standend();
|
|||
int fond_ecran(char *title)
|
||||
{
|
||||
char *tp;
|
||||
struct utsname utsn;
|
||||
int foo;
|
||||
|
||||
#if TRACE
|
||||
int foo;
|
||||
char buffer[200];
|
||||
#endif
|
||||
|
||||
|
@ -41,6 +44,14 @@ sprintf(buffer, " ecran %dx%d ", COLS, LINES);
|
|||
foo = strlen(buffer);
|
||||
mvaddstr(0, COLS-2-foo, buffer);
|
||||
#endif
|
||||
|
||||
/* get and display hostname */
|
||||
foo = uname(&utsn);
|
||||
if ( !foo ) {
|
||||
mvaddstr(0, 2+strlen(tp), "on");
|
||||
mvaddstr(0, 5+strlen(tp), utsn.nodename);
|
||||
}
|
||||
|
||||
standend();
|
||||
refresh();
|
||||
|
||||
|
|
載入中…
新增問題並參考