-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmdtop.cpp
More file actions
92 lines (70 loc) · 2 KB
/
mdtop.cpp
File metadata and controls
92 lines (70 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <iostream>
#include <fstream>
#include <string>
#include <unistd.h>
int spl_count = 0;
int count = 8;
constexpr const char* tab = " ";
void clear_screen(){
using namespace std;
cout << "\033[H\033[2J\033[3J";
}
constexpr const char* spl[6] =
{
"███╗ ███╗██████╗ ████████╗ ██████╗ ██████╗ \n",
"████╗ ████║██╔══██╗╚══██╔══╝██╔═══██╗██╔══██╗\n",
"██╔████╔██║██║ ██║ ██║ ██║ ██║██████╔╝\n",
"██║╚██╔╝██║██║ ██║ ██║ ██║ ██║██╔═══╝ \n",
"██║ ╚═╝ ██║██████╔╝ ██║ ╚██████╔╝██║ \n",
"╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═════╝ ╚═╝ \n"
};
void print_tabs(int count) {
using namespace std;
for (int i = 0; i < count; ++i) {
cout << tab;
}
}
void splash(){
using namespace std;
spl_count = 0;
while(spl_count < 6){
cout << spl[spl_count];
spl_count = spl_count + 1;
}
}
int main() {
while(true){
clear_screen();
splash();
std::string path = "/proc/mdstat";
std::ifstream stat_file(path);
if (!stat_file.is_open()) {
std::cerr << "Failed to open: " << path << "\n";
return 1;
}
std::string line;
while (std::getline(stat_file, line)) {
std::cout << line << '\n';
}
stat_file.close();
// Shits broke
// idk why tho
/*
std::string path2 = "/proc/mounts";
std::ifstream df_file(path2);
if (!df_file.is_open()){
std::cerr << "Failed to open: " << path2 << "\n";
return 1;
}
std::string line2;
while (std::getline(df_file, line2)){
if (line.find("/dev/md0") != std::string::npos){
std::cout << line2 << std::endl;
}
}
df_file.close();
*/
usleep(500000);
}
return 0;
}