refactoring
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/03 19:14:46 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/07 06:33:55 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/10/08 03:04:26 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
# include <readline/readline.h> // sudo apt install libreadline-dev
|
||||
# include <readline/history.h>
|
||||
|
||||
# include "minishell_structs.h"
|
||||
# include "minishell_macro.h"
|
||||
# include "minishell_term_colors.h"
|
||||
# include "minishell_prototypes.h"
|
||||
|
||||
/*
|
||||
** <stdio.h>: printf(), perror(), readline()
|
||||
** <unistd.h>: access(), unlink()
|
||||
|
||||
21
headers/minishell_macro.h
Normal file
21
headers/minishell_macro.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* minishell_macro.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:35:55 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/08 03:01:43 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MINISHELL_MACRO_H
|
||||
# define MINISHELL_MACRO_H
|
||||
|
||||
// Macro RL_PROMPT_START_IGNORE == '\001'
|
||||
// Macro RL_PROMPT_END_IGNORE == '\002'
|
||||
# define PROMPT_CHEVRON "> "
|
||||
# define PROMPT_EURO "\001€\002 \001\b\002"
|
||||
|
||||
#endif
|
||||
24
headers/minishell_prototypes.h
Normal file
24
headers/minishell_prototypes.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* minishell_prototypes.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/08 09:28:29 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MINISHELL_PROTOTYPES_H
|
||||
# define MINISHELL_PROTOTYPES_H
|
||||
|
||||
// Init
|
||||
int init(t_all *c);
|
||||
|
||||
// Generic
|
||||
char *ft_strjoinfree(char *s1, char *s2);
|
||||
char *ft_strjoinfree_s1(char *s1, const char *s2);
|
||||
char *ft_strjoinfree_s2(const char *s1, char *s2);
|
||||
|
||||
#endif
|
||||
22
headers/minishell_structs.h
Normal file
22
headers/minishell_structs.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* minishell_structs.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/08 18:59:02 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MINISHELL_STRUCTS_H
|
||||
# define MINISHELL_STRUCTS_H
|
||||
|
||||
typedef struct s_all
|
||||
{
|
||||
char *prompt_base;
|
||||
char *prompt;
|
||||
} t_all;
|
||||
|
||||
#endif
|
||||
38
headers/minishell_term_colors.h
Normal file
38
headers/minishell_term_colors.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* minishell_term_colors.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:37:57 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/08 02:51:13 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MINISHELL_TERM_COLORS_H
|
||||
# define MINISHELL_TERM_COLORS_H
|
||||
|
||||
// https://chrisyeh96.github.io/2020/03/28/terminal-colors.html
|
||||
|
||||
// Macro RL_PROMPT_START_IGNORE == '\001'
|
||||
// Macro RL_PROMPT_END_IGNORE == '\002'
|
||||
# define TERM_RESET "\001\e[0m\002"
|
||||
# define TERM_BLACK "\001\e[0;30m\002"
|
||||
# define TERM_GRAY "\001\e[1;30m\002"
|
||||
# define TERM_RED "\001\e[0;31m\002"
|
||||
# define TERM_LIGHT_RED "\001\e[1;31m\002"
|
||||
# define TERM_GREEN "\001\e[0;32m\002"
|
||||
# define TERM_LIGHT_GREEN "\001\e[1;32m\002"
|
||||
# define TERM_BROWN "\001\e[0;33m\002"
|
||||
# define TERM_YELLOW "\001\e[1;33m\002"
|
||||
# define TERM_BLUE "\001\e[0;34m\002"
|
||||
# define TERM_LIGHT_BLUE "\001\e[1;34m\002"
|
||||
# define TERM_PURPLE "\001\e[0;35m\002"
|
||||
# define TERM_LIGHT_PURPLE "\001\e[1;35m\002"
|
||||
# define TERM_CYAN "\001\e[0;36m\002"
|
||||
# define TERM_LIGHT_CYAN "\001\e[1;36m\002"
|
||||
# define TERM_LIGHT_GRAY "\001\e[0;37m\002"
|
||||
# define TERM_WHITE "\001\e[1;37m\002"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user