[ADD] too much colors (and change header)

This commit is contained in:
mcolonna 2024-05-01 12:48:12 +02:00
parent d7b4631701
commit f8c50143d6
5 changed files with 72 additions and 51 deletions

1
dev/lolcat.sh Executable file
View file

@ -0,0 +1 @@
COLORTERM= lolcat -p 1 -F 0.3 -S 0 -f header.nocolor > header

21
header Normal file
View file

@ -0,0 +1,21 @@
 Welcome to__________________________________
||  ___        ___                           ||
|| |   \      /   |                          ||
|| | |\ \    / /| |   _    __     _    _     ||
|| | | \ \  / / | |  |_|  |  \   | |  |_|    ||
|| | |  \ \/ /  | |   _   |   \  | |   _     ||
|| | |   \  /   | |  | |  | |\ \ | |  | |    ||
|| | |    \/    | |  | |  | | \ \| |  | |    ||
|| | |          | |  | |  | |  \   |  | |    ||
|| |_|          |_|  |_|  |_|   \__|  |_|    ||
||                                           ||
||       =====     By: Mylan COLONNA         ||
||      //            And: Joris SCHAFT      ||
||     //                                    ||
||     \\                                    ||
||      =====  ||  ||  ==== ||    ||         ||
||          \\ ||  || ||    ||    ||         ||
||          // |====| |===  ||    ||         ||
||         //  ||  || ||    ||    ||         ||
||     =====   ||  ||  ====  ====  ====      ||
||___________________________________________||

21
header.nocolor Normal file
View file

@ -0,0 +1,21 @@
Welcome to__________________________________
|| ___ ___ ||
|| | \ / | ||
|| | |\ \ / /| | _ __ _ _ ||
|| | | \ \ / / | | |_| | \ | | |_| ||
|| | | \ \/ / | | _ | \ | | _ ||
|| | | \ / | | | | | |\ \ | | | | ||
|| | | \/ | | | | | | \ \| | | | ||
|| | | | | | | | | \ | | | ||
|| |_| |_| |_| |_| \__| |_| ||
|| ||
|| ===== By: Mylan COLONNA ||
|| // And: Joris SCHAFT ||
|| // ||
|| \\ ||
|| ===== || || ==== || || ||
|| \\ || || || || || ||
|| // |====| |=== || || ||
|| // || || || || || ||
|| ===== || || ==== ==== ==== ||
||___________________________________________||

View file

@ -6,7 +6,7 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */ /* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/23 15:03:23 by mcolonna #+# #+# */ /* Created: 2024/04/23 15:03:23 by mcolonna #+# #+# */
/* Updated: 2024/04/29 15:11:06 by mcolonna ### ########.fr */ /* Updated: 2024/05/01 12:46:34 by mcolonna ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -16,7 +16,7 @@ const char *ask_command(const t_memclass mc)
{ {
const char *r; const char *r;
print_str(fatal_error, 1, "( ^.^)> "); print_str(fatal_error, 1, "\e[1m\e[38;5;45m( ^.^)> \e[0m");
r = read_line(fatal_error, mc, 0); r = read_line(fatal_error, mc, 0);
if (r) if (r)
return (r); return (r);

View file

@ -6,53 +6,15 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */ /* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/23 14:33:45 by mcolonna #+# #+# */ /* Created: 2024/04/23 14:33:45 by mcolonna #+# #+# */
/* Updated: 2024/04/30 16:06:11 by mcolonna ### ########.fr */ /* Updated: 2024/05/01 11:35:54 by mcolonna ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "include.h" #include "include.h"
// Clean the screen
static void execclear(char *const envp[])
{
const t_memclass mc = mem_subclass(fatal_error, g_mc);
t_command command;
command = parse_command(mc, "clear");
if (command.error)
return ;
execute_command(mc, command, envp);
mem_freeall(mc);
}
// Print hi :D
static void print_hi(void)
{
printf("Welcome to____________________________________\n");
printf("|| ___ ___ ||\n");
printf("|| | \\ / | ||\n");
printf("|| | |\\ \\ / /| | __ __ __ __ ||\n");
printf("|| | | \\ \\ / / | | |__| ||\\ || |__| ||\n");
printf("|| | | \\ \\/ / | | __ || \\ || __ ||\n");
printf("|| | | \\ / | | || || \\ || || ||\n");
printf("|| | | \\/ | | || || \\ || || ||\n");
printf("|| | | | | || || \\ || || ||\n");
printf("|| |_| |_| || || \\|| || ||\n");
printf("|| _____ ||\n");
printf("|| / ___| By: Mylan COLONNA ||\n");
printf("|| \\ \\ And: Joris SCHAFT ||\n");
printf("|| \\ \\ ||\n");
printf("|| \\ \\ __ __ __ __ __ ||\n");
printf("|| \\ \\ || || ||=== || || ||\n");
printf("|| \\ \\ || || || || || ||\n");
printf("|| / / ||===|| ||=== || || ||\n");
printf("|| ___/ / || || || || || ||\n");
printf("|| |____/ || || ||=== ||=== ||=== ||\n");
printf("|_____________________________________________|\n\n");
}
t_memclass g_mc; t_memclass g_mc;
// Close the input and output fds of the command.
static void close_fds(const t_command *command) static void close_fds(const t_command *command)
{ {
if (command->input_fd != 0) if (command->input_fd != 0)
@ -63,30 +25,46 @@ static void close_fds(const t_command *command)
minishell_error("errno"); minishell_error("errno");
} }
// Execute a command from a string.
static int do_command(char *const envp[], const char *str)
{
const t_memclass mc = mem_subclass(fatal_error, g_mc);
t_command command;
int r;
command = parse_command(mc, str);
if (command.error || command.empty)
return (command.error);
r = execute_command(mc, command, envp);
mem_freeall(mc);
close_fds(&command);
return (r);
}
static void start(char *const envp[])
{
do_command(envp, "clear");
do_command(envp, "cat ./header");
do_command(envp, "echo");
}
int main(const int argc, const char *argv[], char *const envp[]) int main(const int argc, const char *argv[], char *const envp[])
{ {
t_memclass mc; t_memclass mc;
const char *command_str; const char *command_str;
t_command command;
int errorstatus; int errorstatus;
(void)argc; (void)argc;
(void)argv; (void)argv;
g_mc = NULL; g_mc = NULL;
g_mc = mem_newclass(fatal_error); g_mc = mem_newclass(fatal_error);
execclear(envp); start(envp);
print_hi();
errorstatus = 0; errorstatus = 0;
while (true) while (true)
{ {
mc = mem_subclass(fatal_error, g_mc); mc = mem_subclass(fatal_error, g_mc);
command_str = ask_command(mc); command_str = ask_command(mc);
command = parse_command(mc, command_str); do_command(envp, command_str);
if (command.error || command.empty)
continue ;
errorstatus = execute_command(mc, command, envp);
mem_freeall(mc);
close_fds(&command);
} }
return (errorstatus); return (errorstatus);
} }