Skip to content

visual improvements were added #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/cpu/cpu_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
#include <dirent.h>

void print_cpu_info() {
printf("CPU Information:\n");
printf(" ____________\n");
printf("|\n");
printf("| CPU Info:\n");
printf("|____________\n");
printf("|\n");

FILE *cpu_file = fopen("/proc/cpuinfo", "r");
if (cpu_file) {
char line[128];
int lines = 0;
while (fgets(line, sizeof(line), cpu_file) && lines < 19) {
printf("%s", line);
printf("| %s", line);
lines++;
}
fclose(cpu_file);
printf("|____________\n\n");
} else {
printf("Error opening /proc/cpuinfo\n");
}
Expand Down
12 changes: 9 additions & 3 deletions src/ram/ram_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
void print_ram_info() {
struct sysinfo sys_info;
sysinfo(&sys_info);
printf("Uptime: %ld Hours\n", sys_info.uptime / 60 / 60);
printf("Total RAM: %ld MiB\n", sys_info.totalram * sys_info.mem_unit /
printf(" ____________\n");
printf("|\n");
printf("| RAM Info\n");
printf("|____________\n");
printf("|\n");
printf("| Uptime: %ld Hours\n", sys_info.uptime / 60 / 60);
printf("| Total RAM: %ld MiB\n", sys_info.totalram * sys_info.mem_unit /
1024 / 1024);
printf("Free RAM: %ld MiB\n", sys_info.freeram * sys_info.mem_unit / 1024
printf("| Free RAM: %ld MiB\n", sys_info.freeram * sys_info.mem_unit / 1024
/ 1024);
printf("|____________\n\n");
}
13 changes: 9 additions & 4 deletions src/rom/rom_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
#include <sys/statvfs.h>

void print_rom_info() {
printf("\nDisk Information:\n");
printf(" ____________\n");
printf("|\n");
printf("| ROM Info:\n");
printf("|____________\n");
printf("|\n");
struct statvfs fs_info;
if (statvfs("/", &fs_info) == 0) {
printf("Total Disk Space: %ld MiB\n", fs_info.f_blocks * fs_info.f_bsize
printf("| Total Disk Space: %ld MiB\n", fs_info.f_blocks * fs_info.f_bsize
/ 1024 / 1024);
printf("Free Disk Space: %ld MiB\n", fs_info.f_bfree * fs_info.f_bsize /
printf("| Free Disk Space: %ld MiB\n", fs_info.f_bfree * fs_info.f_bsize /
1024 / 1024);
printf("Used Disk Space: %ld MiB\n", (fs_info.f_blocks -
printf("| Used Disk Space: %ld MiB\n", (fs_info.f_blocks -
fs_info.f_bfree) * fs_info.f_bsize / 1024 / 1024);
printf("|____________\n\n");
}
}
16 changes: 11 additions & 5 deletions src/sys/sys_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
void print_sys_info() {
struct utsname sys_info;
uname(&sys_info);
printf("System Name: %s\n", sys_info.sysname);
printf("Host Name: %s\n", sys_info.nodename);
printf("Kernel Release: %s\n", sys_info.release);
printf("System Version: %s\n", sys_info.version);
printf("Machine Type: %s\n", sys_info.machine);
printf(" ____________\n");
printf("|\n");
printf("| System Info\n");
printf("|____________\n");
printf("|\n");
printf("| System Name: %s\n", sys_info.sysname);
printf("| Host Name: %s\n", sys_info.nodename);
printf("| Kernel Release: %s\n", sys_info.release);
printf("| System Version: %s\n", sys_info.version);
printf("| Machine Type: %s\n", sys_info.machine);
printf("|____________\n\n");
}