CLI : monitor command; get terminal size and print screen
This commit is contained in:
parent
a95279b7ef
commit
7561ae646d
11
src/cli.c
11
src/cli.c
|
@ -55,6 +55,7 @@
|
|||
#define C_COLOR_YELLOW "\e[00;33m"
|
||||
#define C_COLOR_GREEN "\e[00;32m"
|
||||
#define C_COLOR_BLUE "\e[01;34m"
|
||||
#define C_COLOR_REVERSE "\e[7m"
|
||||
#define C_COLOR_NORMAL "\e[0m"
|
||||
|
||||
#define NON_BLOCKING 1
|
||||
|
@ -123,7 +124,7 @@ static inline int getch(bool nonBlocking)
|
|||
}
|
||||
|
||||
//
|
||||
// Decorations
|
||||
// Print monitor screen
|
||||
//
|
||||
void decorateMonitor(struct winsize *terminalSize)
|
||||
{
|
||||
|
@ -131,7 +132,7 @@ static inline int getch(bool nonBlocking)
|
|||
|
||||
// print decorations
|
||||
for (int i = 0; i < terminalSize->ws_col; i++) {
|
||||
printf("*");
|
||||
printf(C_COLOR_REVERSE " " C_COLOR_NORMAL);
|
||||
}
|
||||
|
||||
for (int i = 0;
|
||||
|
@ -139,13 +140,13 @@ static inline int getch(bool nonBlocking)
|
|||
i++) {
|
||||
if ((i % terminalSize->ws_col == 0) ||
|
||||
(i % terminalSize->ws_col == terminalSize->ws_col - 1))
|
||||
printf("|");
|
||||
printf(C_COLOR_REVERSE " " C_COLOR_NORMAL);
|
||||
else
|
||||
printf(" ");
|
||||
printf(C_COLOR_NORMAL " " C_COLOR_NORMAL);
|
||||
}
|
||||
|
||||
for (int i = 0; i < terminalSize->ws_col; i++) {
|
||||
printf("*");
|
||||
printf(C_COLOR_REVERSE " " C_COLOR_NORMAL);
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
|
|
Loading…
Reference in New Issue