From 56378b20f42b3dfb64c626f0bd7c7f59d0fffa50 Mon Sep 17 00:00:00 2001 From: Anser Date: Thu, 23 Jul 2026 23:40:23 +0200 Subject: some basic logos --- src/logo/logo.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/logo/logo.c (limited to 'src/logo/logo.c') diff --git a/src/logo/logo.c b/src/logo/logo.c new file mode 100644 index 0000000..749b999 --- /dev/null +++ b/src/logo/logo.c @@ -0,0 +1,73 @@ +#include "logo.h" +#include +#include +#include + +#define MAX_LOGOS 2 + +const char **logo(int index) { + + static const char *logo0[] = { +" _____________", +" / \\", +" | ☆ ☆ ☆ |", +" | ☆ ☭ ☆ |", +" | ☆ ☆ ☆ |", +" \\_____________/", +" Рабочие мира, объединяйтесь!", + NULL + }; + + + static const char *logo1[] = { +" ╔═══════════════════╗", +" ║ ║", +" ║ ☭ C C C P ☭ ║", +" ║ ║", +" ╚═══════════════════╝", +" Власть — Советам!", + NULL + }; + + if (index < 0 || index >= MAX_LOGOS) return NULL; + + switch (index) { + case 0: + return logo0; + case 1: + return logo1; + default: + return NULL; + } +} + +int get_line_length(const char **line) { + size_t length = 0; + size_t max_length = 0; + + if (line == NULL) return -1; + for (int i = 0; line[i] != NULL; i++) { + length = strlen(line[i]); + + if (length > max_length) { + max_length = length; + } + } + return max_length; +} + +void print_logo(void) { + int length = 0; + + for (int i = 0; i < MAX_LOGOS; i++) { + const char **lines = logo(i); + if (lines == NULL) continue; + + length = get_line_length(lines); + + for (int j = 0; lines[j] != NULL ; j++) { + printf("%s\n", lines[j]); + } + printf("%d\n", length); + } +} -- cgit v1.2.3