2024-06-17 22:41:46 +09:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "src/user.h"
|
|
|
|
#include "src/os.h"
|
|
|
|
#if defined(__linux__)
|
|
|
|
#include "src/distro.h"
|
|
|
|
#endif
|
2024-06-18 14:06:43 +09:00
|
|
|
#include "src/host.h"
|
|
|
|
#include "src/uptime.h"
|
|
|
|
#if defined(__OpenBSD__)
|
|
|
|
#include "src/recording.h"
|
|
|
|
#endif
|
2024-06-18 13:39:02 +09:00
|
|
|
#include "src/cpu.h"
|
2024-06-18 00:16:45 +09:00
|
|
|
#include "src/memory.h"
|
2024-06-17 22:41:46 +09:00
|
|
|
|
|
|
|
const char *sofname = "farfetch";
|
|
|
|
const char *version = "0.0.1";
|
|
|
|
|
|
|
|
int main() {
|
2024-06-18 15:25:34 +09:00
|
|
|
#if defined(__OpenBSD__)
|
|
|
|
#include "src/logo/openbsd.h"
|
|
|
|
#else
|
|
|
|
#define COLOR "\e[1;30m"
|
|
|
|
#define RESET "\e[0m"
|
|
|
|
char *LOGO[] = {
|
|
|
|
" ⢀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⣠⠾⠛⠶⣄⢀⣠⣤⠴⢦⡀⠀⠀⠀⠀",
|
|
|
|
"⠀⠀⠀⢠⡿⠉⠉⠉⠛⠶⠶⠖⠒⠒⣾⠋⠀⢀⣀⣙⣯⡁⠀⠀⠀⣿⠀⠀⠀⠀",
|
|
|
|
"⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⡏⠀⠀⢯⣼⠋⠉⠙⢶⠞⠛⠻⣆⠀⠀⠀",
|
|
|
|
"⠀⠀⠀⢸⣧⠆⠀⠀⠀⠀⠀⠀⠀⠀⠻⣦⣤⡤⢿⡀⠀⢀⣼⣷⠀⠀⣽⠀⠀⠀",
|
|
|
|
"⠀⠀⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⢏⡉⠁⣠⡾⣇⠀⠀⠀",
|
|
|
|
"⠀⠀⢰⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠋⠉⠀⢻⡀⠀⠀",
|
|
|
|
"⣀⣠⣼⣧⣤⠀⠀⠀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠐⠖⢻⡟⠓⠒",
|
|
|
|
"⠀⠀⠈⣷⣀⡀⠀⠘⠿⠇⠀⠀⠀⢀⣀⣀⠀⠀⠀⠀⠿⠟⠀⠀⠀⠲⣾⠦⢤⠀",
|
|
|
|
"⠀⠀⠋⠙⣧⣀⡀⠀⠀⠀⠀⠀⠀⠘⠦⠼⠃⠀⠀⠀⠀⠀⠀⠀⢤⣼⣏⠀⠀⠀",
|
|
|
|
"⠀⠀⢀⠴⠚⠻⢧⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⠞⠉⠉⠓⠀⠀",
|
|
|
|
"⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠶⠶⠶⣶⣤⣴⡶⠶⠶⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀"
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
printf("%s ", LOGO[0]);
|
|
|
|
printf(COLOR);
|
2024-06-17 22:41:46 +09:00
|
|
|
display_user_name();
|
2024-06-18 15:25:34 +09:00
|
|
|
printf(RESET);
|
2024-06-17 22:41:46 +09:00
|
|
|
printf("@");
|
2024-06-18 15:25:34 +09:00
|
|
|
printf(COLOR);
|
2024-06-17 22:41:46 +09:00
|
|
|
display_user_host();
|
2024-06-18 15:25:34 +09:00
|
|
|
printf(RESET);
|
|
|
|
printf("%s ", LOGO[1]);
|
2024-06-18 00:44:43 +09:00
|
|
|
printf("------------------\n");
|
2024-06-17 22:41:46 +09:00
|
|
|
|
2024-06-18 15:25:34 +09:00
|
|
|
printf("%s ", LOGO[2]);
|
|
|
|
printf(COLOR"%s%s"RESET, "OS", ": ");
|
2024-06-17 22:41:46 +09:00
|
|
|
display_os_name();
|
|
|
|
printf(" ");
|
|
|
|
display_os_vers();
|
|
|
|
printf(" ");
|
|
|
|
display_os_arch();
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
#if defined(__linux__)
|
2024-06-18 15:25:34 +09:00
|
|
|
printf(COLOR"%s%s"RESET, "Distro", ": ");
|
2024-06-17 22:41:46 +09:00
|
|
|
display_distro();
|
|
|
|
printf("\n");
|
|
|
|
#endif
|
|
|
|
|
2024-06-18 15:25:34 +09:00
|
|
|
printf("%s ", LOGO[3]);
|
|
|
|
printf(COLOR"%s%s"RESET, "Host", ": ");
|
2024-06-18 00:16:45 +09:00
|
|
|
display_host_model();
|
|
|
|
printf("\n");
|
|
|
|
|
2024-06-18 15:25:34 +09:00
|
|
|
printf("%s ", LOGO[4]);
|
|
|
|
printf(COLOR"%s%s"RESET, "Uptime", ": ");
|
2024-06-18 16:42:23 +09:00
|
|
|
#ifndef __NetBSD__
|
2024-06-18 13:39:02 +09:00
|
|
|
display_days();
|
|
|
|
printf(", ");
|
2024-06-18 16:42:23 +09:00
|
|
|
#endif
|
2024-06-18 13:39:02 +09:00
|
|
|
display_time();
|
|
|
|
printf("\n");
|
|
|
|
|
2024-06-18 14:06:43 +09:00
|
|
|
#if defined(__OpenBSD__)
|
2024-06-18 15:25:34 +09:00
|
|
|
printf("%s ", LOGO[5]);
|
|
|
|
printf(COLOR"%s%s"RESET, "Recording", ": ");
|
|
|
|
printf("audio = ");
|
2024-06-18 14:06:43 +09:00
|
|
|
display_recording_audio();
|
|
|
|
printf(", video = ");
|
|
|
|
display_recording_video();
|
|
|
|
printf("\n");
|
|
|
|
#endif
|
|
|
|
|
2024-06-18 15:25:34 +09:00
|
|
|
printf("%s ", LOGO[6]);
|
|
|
|
printf(COLOR"%s%s"RESET, "CPU", ": ");
|
2024-06-18 13:39:02 +09:00
|
|
|
display_cpu();
|
|
|
|
printf("\n");
|
|
|
|
|
2024-06-18 15:25:34 +09:00
|
|
|
printf("%s ", LOGO[7]);
|
|
|
|
printf(COLOR"%s%s"RESET, "Memory", ": ");
|
2024-06-18 00:16:45 +09:00
|
|
|
display_memory();
|
|
|
|
printf("\n");
|
|
|
|
|
2024-06-18 15:25:34 +09:00
|
|
|
for (size_t i = 8; i < sizeof(LOGO) / sizeof(LOGO[0]); i++) {
|
|
|
|
printf("%s\n", LOGO[i]);
|
|
|
|
}
|
|
|
|
|
2024-06-17 22:41:46 +09:00
|
|
|
// TODO:
|
|
|
|
// * ロゴ
|
|
|
|
// * パッケージ
|
|
|
|
// * libc
|
|
|
|
// * シェル
|
|
|
|
// * 解像度
|
|
|
|
// * 端末
|
|
|
|
// * GPU
|
|
|
|
// * ストレージ
|
|
|
|
return 0;
|
|
|
|
}
|