61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/utsname.h>
|
|
|
|
#include <getopt.h>
|
|
#include <ncurses.h>
|
|
|
|
|
|
#include "ecran.h"
|
|
|
|
int verbosity;
|
|
|
|
/* ---------------------------------------------------------------- */
|
|
/* ---------------------------------------------------------------- */
|
|
void barre_inverse(char c, int ligne)
|
|
{
|
|
int foo;
|
|
standout();
|
|
for (foo=0; foo<COLS; foo++)
|
|
mvaddch(ligne, foo, c);
|
|
standend();
|
|
/* refresh(); */
|
|
}
|
|
/* ---------------------------------------------------------------- */
|
|
int fond_ecran(char *title)
|
|
{
|
|
char *tp;
|
|
struct utsname utsn;
|
|
int foo;
|
|
|
|
#if TRACE
|
|
char buffer[200];
|
|
#endif
|
|
|
|
tp = " DD2 MONITORING by tTh 2019 ";
|
|
if (NULL != title) tp = title;
|
|
|
|
barre_inverse(' ', 0);
|
|
standout();
|
|
mvaddstr(0, 2, tp);
|
|
#if TRACE
|
|
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();
|
|
|
|
return 0;
|
|
}
|
|
/* ---------------------------------------------------------------- */
|