DD2-monitor/viz/curses/ecran.c

61 lines
1.1 KiB
C
Raw Normal View History

2019-01-10 11:44:47 +11:00
#include <stdio.h>
#include <stdlib.h>
2019-01-11 00:07:56 +11:00
#include <string.h>
#include <sys/utsname.h>
2019-01-10 11:44:47 +11:00
#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(); */
}
/* ---------------------------------------------------------------- */
2019-01-11 00:07:56 +11:00
int fond_ecran(char *title)
2019-01-10 11:44:47 +11:00
{
2019-01-11 00:07:56 +11:00
char *tp;
struct utsname utsn;
int foo;
2019-01-11 00:07:56 +11:00
2019-01-10 11:44:47 +11:00
#if TRACE
char buffer[200];
#endif
2019-01-11 00:07:56 +11:00
tp = " DD2 MONITORING by tTh 2019 ";
if (NULL != title) tp = title;
barre_inverse(' ', 0);
2019-01-10 11:44:47 +11:00
standout();
2019-01-11 00:07:56 +11:00
mvaddstr(0, 2, tp);
2019-01-10 11:44:47 +11:00
#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);
}
2019-01-10 11:44:47 +11:00
standend();
refresh();
return 0;
}
/* ---------------------------------------------------------------- */