summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author諏訪子 <suwako@076.moe>2024-06-18 15:25:34 +0900
committer諏訪子 <suwako@076.moe>2024-06-18 15:25:34 +0900
commit0a0916ccebae20e7ee6feafa417cfebd8256ef04 (patch)
tree597c44e2fa4761dbf01039e222408e185aea2483
parentcfc9d105e6b808922a5dc8c357225a9fba1236e2 (diff)
ロゴ
-rw-r--r--main.c49
-rw-r--r--src/distro.c1
-rw-r--r--src/distro.h2
-rw-r--r--src/logo/openbsd.h34
4 files changed, 81 insertions, 5 deletions
diff --git a/main.c b/main.c
index 63a6a0a..44b436f 100644
--- a/main.c
+++ b/main.c
@@ -19,12 +19,39 @@ const char *sofname = "farfetch";
const char *version = "0.0.1";
int main() {
+#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);
display_user_name();
+ printf(RESET);
printf("@");
+ printf(COLOR);
display_user_host();
+ printf(RESET);
+ printf("%s ", LOGO[1]);
printf("------------------\n");
- printf("OS: ");
+ printf("%s ", LOGO[2]);
+ printf(COLOR"%s%s"RESET, "OS", ": ");
display_os_name();
printf(" ");
display_os_vers();
@@ -33,37 +60,49 @@ int main() {
printf("\n");
#if defined(__linux__)
- printf("Distro: ");
+ printf(COLOR"%s%s"RESET, "Distro", ": ");
display_distro();
printf("\n");
#endif
+ printf("%s ", LOGO[3]);
+ printf(COLOR"%s%s"RESET, "Host", ": ");
printf("Host: ");
display_host_model();
printf("\n");
- printf("Uptime: ");
+ printf("%s ", LOGO[4]);
+ printf(COLOR"%s%s"RESET, "Uptime", ": ");
display_days();
printf(", ");
display_time();
printf("\n");
#if defined(__OpenBSD__)
- printf("Recording: audio = ");
+ printf("%s ", LOGO[5]);
+ printf(COLOR"%s%s"RESET, "Recording", ": ");
+ printf("audio = ");
display_recording_audio();
printf(", video = ");
display_recording_video();
printf("\n");
#endif
- printf("CPU: ");
+ printf("%s ", LOGO[6]);
+ printf(COLOR"%s%s"RESET, "CPU", ": ");
display_cpu();
printf("\n");
+ printf("%s ", LOGO[7]);
+ printf(COLOR"%s%s"RESET, "Memory", ": ");
printf("Memory: ");
display_memory();
printf("\n");
+ for (size_t i = 8; i < sizeof(LOGO) / sizeof(LOGO[0]); i++) {
+ printf("%s\n", LOGO[i]);
+ }
+
// TODO:
// * ロゴ
// * パッケージ
diff --git a/src/distro.c b/src/distro.c
index 8830e7c..75bf0a4 100644
--- a/src/distro.c
+++ b/src/distro.c
@@ -49,6 +49,7 @@ void display_distro() {
while (fgets(buf, sizeof(buf), p) != NULL) {
buf[strcspn(buf, "\n")] = '\0';
printf("%s", buf);
+ distroname = buf;
}
pclose(p);
diff --git a/src/distro.h b/src/distro.h
index c4ecfd6..769fa81 100644
--- a/src/distro.h
+++ b/src/distro.h
@@ -4,5 +4,7 @@
void display_distro();
+const char *distroname;
+
#endif
#endif
diff --git a/src/logo/openbsd.h b/src/logo/openbsd.h
new file mode 100644
index 0000000..ae0474a
--- /dev/null
+++ b/src/logo/openbsd.h
@@ -0,0 +1,34 @@
+#define GREY "\e[1;30m"
+#define RED "\e[1;31m"
+#define YELLOW "\e[1;33m"
+#define CYAN "\e[1;36m"
+#define RESET "\e[0m"
+
+#define COLOR YELLOW
+#define TITLECOLOR YELLOW
+
+char *LOGO[] = {
+CYAN " _ " RESET,
+CYAN " (_) " RESET,
+YELLOW " | . " RESET,
+YELLOW " . |L /| . " CYAN "_ " RESET,
+YELLOW " _ . |\\ _| \\--+._/| . " CYAN " (_) " RESET,
+YELLOW " / ||\\| Y J ) / |/| ./ " RESET,
+YELLOW " J |)'( | ` F`.'/ " CYAN " _ " RESET,
+YELLOW " -<| F __ .-< " CYAN " (_) " RESET,
+YELLOW " | / .-'" CYAN "." YELLOW " `. /" CYAN "-. " YELLOW "L___ " RESET,
+YELLOW " J \\ < " CYAN "\\ " YELLOW " | |" GREY " O" CYAN "\\" YELLOW "|.-' " CYAN " _ " RESET,
+YELLOW " _J \\ .- \\" CYAN "/" GREY " O " CYAN "|" YELLOW" | \\ |F " CYAN " (_) " RESET,
+YELLOW " '-F -<_. \\ .-' `-' L__ " RESET,
+YELLOW "__J _ _. >-' )" RED "._." YELLOW " |-' " RESET,
+YELLOW " `-|.' /_. " RED "\\_|" YELLOW " F " RESET,
+YELLOW " /.- . _.< " RESET,
+YELLOW " /' /.' .' `\\ " RESET,
+YELLOW " /L /' |/ _.-'-\\ " RESET,
+YELLOW " /'J ___.---'\\| " RESET,
+YELLOW " |\\ .--' V | `. ` " RESET,
+YELLOW " |/`. `-. `._) " RESET,
+YELLOW " / .-.\\ " RESET,
+YELLOW " \\ ( `\\ " RESET,
+YELLOW " `.\\ " RESET
+};