From daefee35e0c6a603f79f9cd980e23f3c7177748c Mon Sep 17 00:00:00 2001 From: Loic Deridder Date: Fri, 14 Feb 2025 11:00:53 +0100 Subject: [PATCH] readline display --- includes/minishell.h | 12 ++++++------ lib/libft/colors.h | 2 +- srcs/execution/exec_redir.c | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/includes/minishell.h b/includes/minishell.h index 734f033..4fc452f 100644 --- a/includes/minishell.h +++ b/includes/minishell.h @@ -61,11 +61,11 @@ void handle_sigint(int sig); void handle_sigquit(int sig); char *powerline(t_msh *msh); -# define POW1 "\033[1;38;2;21;22;26;48;2;92;106;178m" -# define POW2 "\033[1;38;2;92;106;178;48;2;54;54;54m" -# define POW3 "\033[1;38;2;54;54;54;48;2;39;39;39m" -# define POW4 "\033[0;38;2;204;205;209;48;2;39;39;39m" -# define POW5 "\033[1;38;2;39;39;39m" -# define SEP "\033[38;2;64;64;64m" +# define POW1 "\001\033[1;38;2;21;22;26;48;2;92;106;178m\002" +# define POW2 "\001\033[1;38;2;92;106;178;48;2;54;54;54m\002" +# define POW3 "\001\033[1;38;2;54;54;54;48;2;39;39;39m\002" +# define POW4 "\001\033[0;38;2;204;205;209;48;2;39;39;39m\002" +# define POW5 "\001\033[1;38;2;39;39;39m\002" +# define SEP "\001\033[38;2;64;64;64m\002" #endif diff --git a/lib/libft/colors.h b/lib/libft/colors.h index 6dc1431..a90c8b9 100644 --- a/lib/libft/colors.h +++ b/lib/libft/colors.h @@ -13,7 +13,7 @@ #ifndef COLORS_H # define COLORS_H -# define RESET "\033[0m" +# define RESET "\001\033[0m\002" # define BLACK "\033[0;30m" # define RED "\033[0;31m" diff --git a/srcs/execution/exec_redir.c b/srcs/execution/exec_redir.c index 8d3625f..e5856c7 100644 --- a/srcs/execution/exec_redir.c +++ b/srcs/execution/exec_redir.c @@ -16,6 +16,11 @@ int handle_file(t_ast_n *node, int check, int i) { int fd; + if (check == 1 && access(node->files[i], F_OK)) + { + ft_fprintf(2, "%s: %s\n", node->files[i], "No such file or directory"); + return (1); + } if (check == 1) fd = open(node->files[i], O_RDONLY); else if (check == 2)