diff --git a/42sh/.tags b/42sh/.tags index 7c5d043a..82e41de5 100644 --- a/42sh/.tags +++ b/42sh/.tags @@ -11,9 +11,9 @@ builtin_setenv src/builtin/builtin_setenv.c /^int builtin_setenv(char **av, cha builtin_unsetenv src/builtin/builtin_unsetenv.c /^int builtin_unsetenv(char **av, char ***env_p)$/ ft_builtin src/builtin/builtin.c /^int ft_builtin(char **av, char ***env_p)$/ ft_clear_line src/line-editing/ft_clear_line.c /^int ft_clear_line(t_data *data, t_dlist **input_c/ -ft_cmd_exec src/main/ft_cmd.c /^int ft_cmd_exec(char *execpath, char **argv, char/ -ft_cmd_getav src/main/ft_cmd.c /^char **ft_cmd_getav(char *cmd)$/ -ft_cmd_process src/main/ft_cmd.c /^int ft_cmd_process(char **argv, char ***env_p)$/ +ft_cmd_exec src/minishell-exec/ft_cmd.c /^int ft_cmd_exec(char *execpath, char **argv, char/ +ft_cmd_getav src/minishell-exec/ft_cmd.c /^char **ft_cmd_getav(char *cmd)$/ +ft_cmd_process src/minishell-exec/ft_cmd.c /^int ft_cmd_process(char **argv, char ***env_p)$/ ft_cursor_left src/line-editing/ft_cursor_left.c /^int ft_cursor_left(t_data *data, t_dlist **input_/ ft_cursor_right src/line-editing/ft_cursor_right.c /^int ft_cursor_right(t_data *data, t_dlist **input/ ft_env_getval src/main/lib_env.c /^char *ft_env_getval(char **env, char *key)$/ @@ -33,8 +33,9 @@ ft_line_go_up src/line-editing/ft_line_up.c /^int ft_line_go_up(t_dlist **input ft_line_start src/line-editing/ft_line_start.c /^int ft_line_start(t_data *data, t_dlist **input_c/ ft_path_access src/main/lib_path.c /^int ft_path_access(char *execpath, char *execname/ ft_path_findexec src/main/lib_path.c /^char *ft_path_findexec(char **path, char *execname/ -ft_prompt src/main/ft_prompt.c /^int ft_prompt(void)$/ -ft_tc_init src/main/lib_tc.c /^int ft_tc_init(t_data *data)$/ +ft_prompt src/line-editing/ft_prompt.c /^int ft_prompt(void)$/ +ft_tc_init src/line-editing/ft_tc_init.c /^int ft_tc_init(t_data *data)$/ +ft_tokenize src/token/ft_tokenize.c /^t_list *ft_tokenize(char *str)$/ ft_word_left src/line-editing/ft_word_left.c /^int ft_word_left(t_data *data, t_dlist **input_ch/ ft_word_right src/line-editing/ft_word_right.c /^int ft_word_right(t_data *data, t_dlist **input_c/ sig_handler src/main/sig_handler.c /^void sig_handler(int signo)$/ diff --git a/42sh/Makefile b/42sh/Makefile index d68718ce..287d1136 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -11,7 +11,7 @@ D_OBJ = obj F_OBJ = $(notdir $(F_SRC:.c=.o)) DF_OBJ := $(addprefix $(D_OBJ)/, $(F_OBJ)) -D_INC = includes libft/includes +D_INC = includes libft/includes src/line-editing/includes O_INC = $(addprefix -I, $(D_INC)) D_SER = libft @@ -42,6 +42,9 @@ $(D_OBJ)/%.o: $(D_SRC)/*/%.c $(D_INC) libft: @$(MAKE) -C libft/ 2>/dev/null +line-editing: + @$(MAKE) -C line-editing 2>/dev/null + $(NAME): $(DF_OBJ) libft/libft.a $(CC) $(O_INC) $(O_SER) $(O_LIB) $(W_FLAGS) $(DF_OBJ) -o $@ $(D_FLAGS) diff --git a/42sh/Session.vim b/42sh/Session.vim index f1c95865..6300f150 100644 --- a/42sh/Session.vim +++ b/42sh/Session.vim @@ -3,12 +3,12 @@ if &cp | set nocp | endif let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0 let v:this_session=expand(":p") silent only -cd ~/42/minishell +cd ~/minishell if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' let s:wipebuf = bufnr('%') endif set shortmess=aoO -badd +47 includes/minishell.h +badd +26 includes/minishell.h badd +1 src/user-interaction/ft_word_left.c badd +11 src/user-interaction/ft_cursor_left.c badd +8 src/user-interaction/ft_interactive_sh.c @@ -17,19 +17,43 @@ badd +18 src/user-interaction/ft_cursor_right.c badd +7 src/user-interaction/ft_clear_line.c badd +1 src/user-interaction/ft_line_start.c badd +5 src/user-interaction/ft_line_end.c -badd +21 src/main/main.c +badd +24 src/main/main.c badd +12 src/builtin/builtin_exit.c -badd +0 src/user-interaction/ft_cmd.c +badd +1 src/user-interaction/ft_cmd.c badd +8 src/line-editing/ft_cmd.c badd +2 src/main/ft_cmd.c badd +13 src/main/sig_handler.c badd +1 src/main/prompt.c badd +3 src/main/ft_prompt.c -badd +1 src/line-editing/ft_interactive_sh.c +badd +45 src/line-editing/ft_interactive_sh.c badd +7 src/line-editing/ft_key_ctrl_d.c -argglobal +badd +32 src/builtin/builtin_cd.c +badd +4 src/main/lib_expansion.c +badd +19 libft/src/str/ft_strjoin.c +badd +19 libft/src/str/ft_strlen.c +badd +22 libft/src/str/ft_strcat.c +badd +20 src/minishell-exec/ft_cmd.c +badd +10 src/line-editing/ft_key_enter.c +badd +16 src/line-editing/ft_history_add.c +badd +9 src/line-editing/ft_history_up.c +badd +18 src/line-editing/ft_history_down.c +badd +19 src/token/ft_tokenize.c +badd +30 src/line-editing/line-editing.h +badd +1 libft/Makefile +badd +36 Makefile +badd +18 line-editing/Makefile +badd +14 line-editing/includes/line_editing.h +badd +15 src/line-editing/includes/line_editing.h +badd +47 src/line-editing/src/ft_interactive_sh.c +badd +20 src/line-editing/src/ft_key_enter.c +badd +14 src/line-editing/ft_prompt.c +badd +22 src/line-editing/ft_tc_init.c +badd +33 libft/includes/libft.h +badd +5 libft/includes/get_next_line.h +badd +22 src/token/token_init.c +badd +19 src/token/includes/token.h +badd +15 src/token/token_recognition.c silent! argdel * -set stal=2 edit includes/minishell.h set splitbelow splitright wincmd _ | wincmd | @@ -40,8 +64,8 @@ set nosplitbelow set nosplitright wincmd t set winheight=1 winwidth=1 -exe 'vert 1resize ' . ((&columns * 79 + 79) / 158) -exe 'vert 2resize ' . ((&columns * 78 + 79) / 158) +exe 'vert 1resize ' . ((&columns * 91 + 91) / 182) +exe 'vert 2resize ' . ((&columns * 90 + 91) / 182) argglobal setlocal fdm=manual setlocal fde=0 @@ -52,15 +76,15 @@ setlocal fml=1 setlocal fdn=20 setlocal fen silent! normal! zE -let s:l = 68 - ((22 * winheight(0) + 19) / 38) +let s:l = 52 - ((51 * winheight(0) + 37) / 75) if s:l < 1 | let s:l = 1 | endif exe s:l normal! zt -68 -normal! 025| +52 +normal! 042l wincmd w argglobal -edit src/main/main.c +edit src/line-editing/includes/line_editing.h setlocal fdm=manual setlocal fde=0 setlocal fmr={{{,}}} @@ -70,16 +94,16 @@ setlocal fml=1 setlocal fdn=20 setlocal fen silent! normal! zE -let s:l = 9 - ((8 * winheight(0) + 19) / 38) +let s:l = 46 - ((45 * winheight(0) + 37) / 75) if s:l < 1 | let s:l = 1 | endif exe s:l normal! zt -9 +46 normal! 0 wincmd w -exe 'vert 1resize ' . ((&columns * 79 + 79) / 158) -exe 'vert 2resize ' . ((&columns * 78 + 79) / 158) -tabedit src/line-editing/ft_interactive_sh.c +exe 'vert 1resize ' . ((&columns * 91 + 91) / 182) +exe 'vert 2resize ' . ((&columns * 90 + 91) / 182) +tabedit src/main/main.c set splitbelow splitright wincmd _ | wincmd | vsplit @@ -89,8 +113,8 @@ set nosplitbelow set nosplitright wincmd t set winheight=1 winwidth=1 -exe 'vert 1resize ' . ((&columns * 79 + 79) / 158) -exe 'vert 2resize ' . ((&columns * 78 + 79) / 158) +exe 'vert 1resize ' . ((&columns * 91 + 91) / 182) +exe 'vert 2resize ' . ((&columns * 90 + 91) / 182) argglobal setlocal fdm=manual setlocal fde=0 @@ -101,15 +125,15 @@ setlocal fml=1 setlocal fdn=20 setlocal fen silent! normal! zE -let s:l = 36 - ((16 * winheight(0) + 19) / 38) +let s:l = 22 - ((19 * winheight(0) + 37) / 75) if s:l < 1 | let s:l = 1 | endif exe s:l normal! zt -36 -normal! 05| +22 +normal! 09l wincmd w argglobal -edit src/main/sig_handler.c +edit src/line-editing/ft_interactive_sh.c setlocal fdm=manual setlocal fde=0 setlocal fmr={{{,}}} @@ -119,18 +143,87 @@ setlocal fml=1 setlocal fdn=20 setlocal fen silent! normal! zE -let s:l = 13 - ((12 * winheight(0) + 19) / 38) +let s:l = 56 - ((55 * winheight(0) + 37) / 75) if s:l < 1 | let s:l = 1 | endif exe s:l normal! zt -13 -normal! 022| +56 +normal! 012l wincmd w -2wincmd w -exe 'vert 1resize ' . ((&columns * 79 + 79) / 158) -exe 'vert 2resize ' . ((&columns * 78 + 79) / 158) -tabnext 2 -set stal=1 +exe 'vert 1resize ' . ((&columns * 91 + 91) / 182) +exe 'vert 2resize ' . ((&columns * 90 + 91) / 182) +tabedit src/token/includes/token.h +set splitbelow splitright +wincmd _ | wincmd | +vsplit +1wincmd h +wincmd w +set nosplitbelow +set nosplitright +wincmd t +set winheight=1 winwidth=1 +exe 'vert 1resize ' . ((&columns * 91 + 91) / 182) +exe 'vert 2resize ' . ((&columns * 90 + 91) / 182) +argglobal +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let s:l = 18 - ((17 * winheight(0) + 37) / 75) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +18 +normal! 0 +wincmd w +argglobal +edit src/token/ft_tokenize.c +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let s:l = 35 - ((34 * winheight(0) + 37) / 75) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +35 +normal! 01l +wincmd w +exe 'vert 1resize ' . ((&columns * 91 + 91) / 182) +exe 'vert 2resize ' . ((&columns * 90 + 91) / 182) +tabedit src/token/token_init.c +set splitbelow splitright +set nosplitbelow +set nosplitright +wincmd t +set winheight=1 winwidth=1 +argglobal +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let s:l = 19 - ((18 * winheight(0) + 37) / 75) +if s:l < 1 | let s:l = 1 | endif +exe s:l +normal! zt +19 +normal! 031l +tabnext 3 if exists('s:wipebuf') silent exe 'bwipe ' . s:wipebuf endif diff --git a/42sh/includes/minishell.h b/42sh/includes/minishell.h index 796434af..2c61aebe 100644 --- a/42sh/includes/minishell.h +++ b/42sh/includes/minishell.h @@ -1,80 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* minishell.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */ +/* Updated: 2016/11/10 14:54:23 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #ifndef MINISHELL_H # define MINISHELL_H # include "libft.h" +# include "line_editing.h" # include # include # include -# include -# include # include -# define SHELL_PROMPT "$> " -# define BUFF_SIZE 32 -# define READ_BUF 32 -# define FT_KEY_C_D "\x4" -# define FT_KEY_C_H "\x8" -# define FT_KEY_TAB "\x9" -# define FT_KEY_ENTER "\xa" -# define FT_KEY_C_K "\xb" -# define FT_KEY_C_L "\xc" -# define FT_KEY_C_U "\x15" -# define FT_KEY_ESC "\x1b" -# define FT_KEY_UP "\x1b\x5b\x41" -# define FT_KEY_DOWN "\x1b\x5b\x42" -# define FT_KEY_RIGHT "\x1b\x5b\x43" -# define FT_KEY_LEFT "\x1b\x5b\x44" -# define FT_KEY_C_UP "\x1b\x4f\x41" -# define FT_KEY_C_DOWN "\x1b\x4f\x42" -# define FT_KEY_C_RIGHT "\x1b\x4f\x43" -# define FT_KEY_C_LEFT "\x1b\x4f\x44" -# define FT_KEY_DEL "\x7f" - -typedef struct s_stof -{ - char *name; - int (*f)(); -} t_stof; - -typedef struct s_data -{ - char **env; - t_dlist *history; - t_dlist *input_mem; -} t_data; +# define MODE_INPUT 0b0001 +# define MODE_EXEC 0b0010 extern t_stof g_builtins[]; -extern t_stof g_keys[]; extern pid_t g_pid; extern int g_mode; void sig_handler(int signo); -#define MODE_INPUT 0b0001 -#define MODE_EXEC 0b0010 - - -int ft_tc_init(t_data *data); -int ft_interactive_sh(t_data *data); -int ft_prompt(void); -int ft_input_is_escaped(t_dlist *input_chain); -int ft_history_add(t_data *data, t_dlist *input_chain); - -typedef int key_press(t_data *data, t_dlist **input_chain, char *buf); -key_press ft_clear_line; -key_press ft_line_up; -key_press ft_line_down; -key_press ft_line_start; -key_press ft_line_end; -key_press ft_history_up; -key_press ft_history_down; -key_press ft_cursor_left; -key_press ft_cursor_right; -key_press ft_word_left; -key_press ft_word_right; -key_press ft_key_del; -key_press ft_key_enter; -key_press ft_key_basic; -key_press ft_key_ctrl_d; int ft_cmd_process(char **argv, char ***env_p); int ft_cmd_exec(char *execpath, char **argv, char ***env_p); @@ -96,4 +49,6 @@ char *ft_env_getval(char **env, char *key); int ft_path_access(char *execpath, char *execname); char *ft_path_findexec(char **path, char *execname); +int ft_tokenize(t_list **alst, char *str); + #endif diff --git a/42sh/libft b/42sh/libft index 87f04315..b38fc62a 160000 --- a/42sh/libft +++ b/42sh/libft @@ -1 +1 @@ -Subproject commit 87f043154c8e46ae7d0df30ec25ee420ce1b8099 +Subproject commit b38fc62abb47b660dddc683266a7fc3aa805ab96 diff --git a/42sh/src/builtin/builtin_cd.c b/42sh/src/builtin/builtin_cd.c index 0d9fe675..28fb103b 100644 --- a/42sh/src/builtin/builtin_cd.c +++ b/42sh/src/builtin/builtin_cd.c @@ -3,8 +3,7 @@ #define CDOPT_P 0b010 #define HAS_CDOPT_P(x) (x & CD_OPT_P) #define HAS_CDOPT_L(x) (x & CD_OPT_L) -#define CDERR_1 "cd: string not in pwd: %s\n" -#define CDERR_2 "cd: no such file or directory: %s\n" +#define CDERR_1 "cd: no such file or directory: %s\n" int builtin_cd(char **av, char ***env_p) { @@ -16,12 +15,13 @@ int builtin_cd(char **av, char ***env_p) opts = 0; i = builtin_cd_opts(av, &opts); - target = builtin_cd_special(av + i, *env_p); + if (!(target = builtin_cd_special(av + i, *env_p))) + return (0); oldpwd[0] = ft_strdup("OLDPWD"); oldpwd[1] = getcwd(NULL, 0); if (chdir(target)) { - ft_printf(CDERR_2, target); + ft_printf(CDERR_1, target); return (1); } else if (target != av[i]) @@ -30,10 +30,6 @@ int builtin_cd(char **av, char ***env_p) pwd[1] = getcwd(NULL, 0); builtin_setenv(pwd, env_p); builtin_setenv(oldpwd, env_p); - /* { */ - /* printf(CDERR_1, av[-i]); */ - /* return (1) */ - /* } */ return (0); } @@ -42,7 +38,10 @@ char *builtin_cd_special(char **av, char **env) char *target; if (!*av) - target = ft_env_getval(env, "HOME"); + { + if (!(target = ft_env_getval(env, "HOME"))) + return (NULL); + } else if (ft_strcmp(*av, "-") == 0) target = ft_env_getval(env, "OLDPWD"); else diff --git a/42sh/src/line-editing/ft_clear_line.c b/42sh/src/line-editing/ft_clear_line.c index 116eef7f..46a2f275 100644 --- a/42sh/src/line-editing/ft_clear_line.c +++ b/42sh/src/line-editing/ft_clear_line.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_clear_line.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:42:45 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:42:59 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_clear_line(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_cursor_left.c b/42sh/src/line-editing/ft_cursor_left.c index e9bda097..b4a38c05 100644 --- a/42sh/src/line-editing/ft_cursor_left.c +++ b/42sh/src/line-editing/ft_cursor_left.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_cursor_left.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:43:10 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:43:25 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_cursor_left(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_cursor_right.c b/42sh/src/line-editing/ft_cursor_right.c index 499710d4..0ab9995e 100644 --- a/42sh/src/line-editing/ft_cursor_right.c +++ b/42sh/src/line-editing/ft_cursor_right.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_cursor_right.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:43:31 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:43:31 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_cursor_right(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_history_add.c b/42sh/src/line-editing/ft_history_add.c index 507ed1e6..313d31fe 100644 --- a/42sh/src/line-editing/ft_history_add.c +++ b/42sh/src/line-editing/ft_history_add.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_history_add.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:43:40 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:43:50 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_history_add(t_data *data, t_dlist *input_chain) { diff --git a/42sh/src/line-editing/ft_history_down.c b/42sh/src/line-editing/ft_history_down.c index 5d4988be..6ebfaa57 100644 --- a/42sh/src/line-editing/ft_history_down.c +++ b/42sh/src/line-editing/ft_history_down.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_history_down.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:06 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:06 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_history_down(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_history_up.c b/42sh/src/line-editing/ft_history_up.c index 2815077b..7dae6bc4 100644 --- a/42sh/src/line-editing/ft_history_up.c +++ b/42sh/src/line-editing/ft_history_up.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_history_up.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:15 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:15 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_history_up(t_data *data, t_dlist **input_chain, char *buf) { @@ -15,11 +27,11 @@ int ft_history_up(t_data *data, t_dlist **input_chain, char *buf) data->history = data->history->prev; str = data->history->content; /* *input_chain = ft_dlst_last(*input_chain); */ - /* ft_clear_input(input_chain); */ + ft_clear_line(data, input_chain, buf); i = 0; while (str[i]) ft_key_basic(data, input_chain, str + i++); - if (!data->history->next) - ft_strdel(&str); + /* if (!data->history->next) */ + /* ft_strdel(&str); */ return (0); } diff --git a/42sh/src/line-editing/ft_input_is_escaped.c b/42sh/src/line-editing/ft_input_is_escaped.c index 852fbc78..069a9647 100644 --- a/42sh/src/line-editing/ft_input_is_escaped.c +++ b/42sh/src/line-editing/ft_input_is_escaped.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_input_is_escaped.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:17 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:17 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_input_is_escaped(t_dlist *input_chain) { diff --git a/42sh/src/line-editing/ft_interactive_sh.c b/42sh/src/line-editing/ft_interactive_sh.c index ded350c3..d50ecfbf 100644 --- a/42sh/src/line-editing/ft_interactive_sh.c +++ b/42sh/src/line-editing/ft_interactive_sh.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_interactive_sh.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:21 by jhalford #+# #+# */ +/* Updated: 2016/11/10 14:59:44 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" t_stof g_keys[] = { {FT_KEY_C_K, NULL}, @@ -38,15 +50,19 @@ int ft_interactive_sh(t_data *data) (void)data; null = '\0'; + if (!data->history) + data->history = ft_dlst_new(NULL, 0); input_chain = ft_dlst_new(&null, sizeof(char)); + ft_tc_init(data); + ft_prompt(); while (1) { ft_bzero(buf, 20); - ret = read(0, buf, 20); + /* ret = read(0, buf, 20); */ /* ft_printf("read=%i: %#x,%#x,%#x\n", ret, buf[0], buf[1], buf[2]); */ - /* continue ; */ + continue ; i = 0; - while (g_keys[i].name && ft_strequ(buf, g_keys[i].name) == 0) + while (g_keys[i].name && ft_strcmp(buf, g_keys[i].name) == 0) i++; if (!g_keys[i].f) continue ; diff --git a/42sh/src/line-editing/ft_key_basic.c b/42sh/src/line-editing/ft_key_basic.c index c5bfc598..17511927 100644 --- a/42sh/src/line-editing/ft_key_basic.c +++ b/42sh/src/line-editing/ft_key_basic.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_key_basic.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:23 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:23 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_key_basic(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_key_ctrl_d.c b/42sh/src/line-editing/ft_key_ctrl_d.c index f19a8f76..c30a5cd3 100644 --- a/42sh/src/line-editing/ft_key_ctrl_d.c +++ b/42sh/src/line-editing/ft_key_ctrl_d.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_key_ctrl_d.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:24 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:24 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_key_ctrl_d(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_key_del.c b/42sh/src/line-editing/ft_key_del.c index a410f59d..6fa530ef 100644 --- a/42sh/src/line-editing/ft_key_del.c +++ b/42sh/src/line-editing/ft_key_del.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_key_del.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:26 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:26 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_key_del(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_key_enter.c b/42sh/src/line-editing/ft_key_enter.c index aeeb8359..223dc262 100644 --- a/42sh/src/line-editing/ft_key_enter.c +++ b/42sh/src/line-editing/ft_key_enter.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_key_enter.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:30 by jhalford #+# #+# */ +/* Updated: 2016/11/10 14:21:42 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_key_enter(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_line_down.c b/42sh/src/line-editing/ft_line_down.c index c3700b75..b04e747d 100644 --- a/42sh/src/line-editing/ft_line_down.c +++ b/42sh/src/line-editing/ft_line_down.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_line_down.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:31 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:31 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_line_go_down(t_dlist **input_chain) { diff --git a/42sh/src/line-editing/ft_line_end.c b/42sh/src/line-editing/ft_line_end.c index 1b38e300..180fc04a 100644 --- a/42sh/src/line-editing/ft_line_end.c +++ b/42sh/src/line-editing/ft_line_end.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_line_end.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:33 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:33 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_line_end(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_line_start.c b/42sh/src/line-editing/ft_line_start.c index a30fc8d5..e30d9f7d 100644 --- a/42sh/src/line-editing/ft_line_start.c +++ b/42sh/src/line-editing/ft_line_start.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_line_start.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:34 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:34 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_line_start(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_line_up.c b/42sh/src/line-editing/ft_line_up.c index 39ce35bf..15804028 100644 --- a/42sh/src/line-editing/ft_line_up.c +++ b/42sh/src/line-editing/ft_line_up.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_line_up.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:35 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:35 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_line_go_up(t_dlist **input_chain) { diff --git a/42sh/src/line-editing/ft_prompt.c b/42sh/src/line-editing/ft_prompt.c new file mode 100644 index 00000000..252bf9f7 --- /dev/null +++ b/42sh/src/line-editing/ft_prompt.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_prompt.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 14:22:34 by jhalford #+# #+# */ +/* Updated: 2016/11/10 14:22:48 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" + +int ft_prompt(void) +{ + ft_putstr(SHELL_PROMPT); + return (0); +} diff --git a/42sh/src/line-editing/ft_tc_init.c b/42sh/src/line-editing/ft_tc_init.c new file mode 100644 index 00000000..cfa2cb74 --- /dev/null +++ b/42sh/src/line-editing/ft_tc_init.c @@ -0,0 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* lib_tc.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 14:27:57 by jhalford #+# #+# */ +/* Updated: 2016/11/10 14:39:28 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" + +int ft_tc_init(t_data *data) +{ + char *term_name; + struct termios term; + + if ((term_name = ft_getenv(data->env, "TERM")) == NULL) + return (-1); + if (tgetent(NULL, term_name) != 1) + return (-1); + if (tcgetattr(0, &term) == -1) + return (-1); + term.c_lflag &= ~(ICANON); // Met le terminal en mode canonique. + term.c_lflag &= ~(ECHO); // les touches tapées ne s'inscriront plus dans le terminal + term.c_cc[VMIN] = 1; + term.c_cc[VTIME] = 0; + if (tcsetattr(0, TCSADRAIN, &term) == -1) + return (-1); + return (0); +} diff --git a/42sh/src/line-editing/ft_word_left.c b/42sh/src/line-editing/ft_word_left.c index 756b78a1..0626d931 100644 --- a/42sh/src/line-editing/ft_word_left.c +++ b/42sh/src/line-editing/ft_word_left.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_word_left.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:36 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:36 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_word_left(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/ft_word_right.c b/42sh/src/line-editing/ft_word_right.c index 698fc881..1c6e2a4f 100644 --- a/42sh/src/line-editing/ft_word_right.c +++ b/42sh/src/line-editing/ft_word_right.c @@ -1,4 +1,16 @@ -#include "minishell.h" +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_word_right.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:44:37 by jhalford #+# #+# */ +/* Updated: 2016/11/10 13:44:37 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "line_editing.h" int ft_word_right(t_data *data, t_dlist **input_chain, char *buf) { diff --git a/42sh/src/line-editing/includes/line_editing.h b/42sh/src/line-editing/includes/line_editing.h new file mode 100644 index 00000000..c8de2682 --- /dev/null +++ b/42sh/src/line-editing/includes/line_editing.h @@ -0,0 +1,78 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* line-editing.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:38:21 by jhalford #+# #+# */ +/* Updated: 2016/11/10 14:41:23 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LINE_EDITING_H +# define LINE_EDITING_H + +# include "libft.h" +# include +# include + +# define SHELL_PROMPT "$> " +# define BUFF_SIZE 32 +# define READ_BUF 32 +# define FT_KEY_C_D "\x4" +# define FT_KEY_C_H "\x8" +# define FT_KEY_TAB "\x9" +# define FT_KEY_ENTER "\xa" +# define FT_KEY_C_K "\xb" +# define FT_KEY_C_L "\xc" +# define FT_KEY_C_U "\x15" +# define FT_KEY_ESC "\x1b" +# define FT_KEY_UP "\x1b\x5b\x41" +# define FT_KEY_DOWN "\x1b\x5b\x42" +# define FT_KEY_RIGHT "\x1b\x5b\x43" +# define FT_KEY_LEFT "\x1b\x5b\x44" +# define FT_KEY_C_UP "\x1b\x4f\x41" +# define FT_KEY_C_DOWN "\x1b\x4f\x42" +# define FT_KEY_C_RIGHT "\x1b\x4f\x43" +# define FT_KEY_C_LEFT "\x1b\x4f\x44" +# define FT_KEY_SQUOTE "\x22" +# define FT_KEY_DQUOTE "\x27" +# define FT_KEY_BSLASH "\x5c" +# define FT_KEY_DEL "\x7f" + +typedef struct s_data t_data; + +struct s_data +{ + char **env; + t_dlist *history; + t_dlist *input_mem; +}; + +extern t_stof g_keys[]; + +int ft_tc_init(t_data *data); +int ft_interactive_sh(t_data *data); +int ft_prompt(void); +int ft_input_is_escaped(t_dlist *input_chain); +int ft_history_add(t_data *data, t_dlist *input_chain); + +typedef int key_press(t_data *data, t_dlist **input_chain, char *buf); +key_press ft_clear_line; +key_press ft_line_up; +key_press ft_line_down; +key_press ft_line_start; +key_press ft_line_end; +key_press ft_history_up; +key_press ft_history_down; +key_press ft_cursor_left; +key_press ft_cursor_right; +key_press ft_word_left; +key_press ft_word_right; +key_press ft_key_del; +key_press ft_key_enter; +key_press ft_key_basic; +key_press ft_key_ctrl_d; + +#endif diff --git a/42sh/src/main/ft_prompt.c b/42sh/src/main/ft_prompt.c deleted file mode 100644 index a140806b..00000000 --- a/42sh/src/main/ft_prompt.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "minishell.h" - -int ft_prompt(void) -{ - ft_putstr(SHELL_PROMPT); - return (0); -} diff --git a/42sh/src/main/lib_tc.c b/42sh/src/main/lib_tc.c deleted file mode 100644 index 6f42f233..00000000 --- a/42sh/src/main/lib_tc.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "minishell.h" - -int ft_tc_init(t_data *data) -{ - char *term_name; - struct termios term; - - if ((term_name = ft_env_getval(data->env, "TERM")) == NULL) - return (-1); - if (tgetent(NULL, term_name) != 1) - return (-1); - if (tcgetattr(0, &term) == -1) - return (-1); - term.c_lflag &= ~(ICANON); // Met le terminal en mode canonique. - term.c_lflag &= ~(ECHO); // les touches tapées ne s'inscriront plus dans le terminal - term.c_cc[VMIN] = 1; - term.c_cc[VTIME] = 0; - if (tcsetattr(0, TCSADRAIN, &term) == -1) - return (-1); - return (0); -} diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index d864757e..db091491 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -1,29 +1,49 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:35:14 by jhalford #+# #+# */ +/* Updated: 2016/11/10 15:43:18 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "minishell.h" + extern char **environ; int g_mode; int main(void) { t_data data; + char *cmd; char **av; + t_list *token; data.env = ft_sstrdup(environ); - data.history = ft_dlst_new(NULL, 0); - ft_tc_init(&data); + token = NULL; if (signal(SIGINT, sig_handler) == SIG_ERR) ft_printf("\ncan't catch SIGINT\n"); while (1) { g_mode = MODE_INPUT; - ft_prompt(); if (ft_interactive_sh(&data)) return (1); + cmd = ft_strdup(data.history->prev->content); g_mode = MODE_EXEC; - /* ft_printf("got string:'%s'\n", data.history->prev->content); */ - av = ft_cmd_getav(data.history->prev->content); - if (av && av[0]) - ft_cmd_process(av, &data.env); + + /* (void)av; */ + /* ft_printf("got string:'%s'\n", cmd); */ + + /* av = ft_cmd_getav(cmd); */ + /* if (av && av[0]) */ + /* ft_cmd_process(av, &data.env); */ + + (void)av; + if (ft_tokenize(&token, cmd)) + return (1); } return (0); } - diff --git a/42sh/src/main/ft_cmd.c b/42sh/src/minishell-exec/ft_cmd.c similarity index 95% rename from 42sh/src/main/ft_cmd.c rename to 42sh/src/minishell-exec/ft_cmd.c index 50c9998a..bdddebde 100644 --- a/42sh/src/main/ft_cmd.c +++ b/42sh/src/minishell-exec/ft_cmd.c @@ -14,7 +14,6 @@ int ft_cmd_process(char **argv, char ***env_p) execpath = argv[0]; else if (!(execpath = ft_path_findexec(path, argv[0]))) return (-1); - /* ft_printf("%s @ %s\n", argv[0], execpath); */ return (ft_cmd_exec(execpath, argv, env_p)); } diff --git a/42sh/src/token/ft_tokenize.c b/42sh/src/token/ft_tokenize.c new file mode 100644 index 00000000..847f499c --- /dev/null +++ b/42sh/src/token/ft_tokenize.c @@ -0,0 +1,39 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_tokenize.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */ +/* Updated: 2016/11/10 17:04:10 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "minishell.h" + +int ft_tokenize(t_list **alst, char *str) +{ + static int quoted = 0; + t_token *token; + + if (!*alst) + alst = ft_lstnew(token_init(), sizeof(t_token)); + else + token = (*alst)->content; + if (!*str) + return (0); + else if (token->type == TOKEN_OPERATOR && !quoted) + { + if (can_be_used_in_op) + token_append(token, *str); + else + ft_tokenize(&(*alst)->next, str); + } + else if (can_be_first_of_op && !quoted) + { + + } + ft_tokenize(&(*alst)->next, str + 1); + ft_tokenize(alst, str + 1); +} diff --git a/42sh/src/token/includes/token.h b/42sh/src/token/includes/token.h new file mode 100644 index 00000000..cd9bc329 --- /dev/null +++ b/42sh/src/token/includes/token.h @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* token.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 15:31:42 by jhalford #+# #+# */ +/* Updated: 2016/11/10 17:04:12 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef TOKEN_H +# define TOKEN_H + +# define TOKEN_WORD 0b000001 +# define TOKEN_OPERATOR 0b000010 + +typedef struct s_token t_token; + +struct s_token +{ + int type; + char *content; + char *size; +}; + +t_token *token_init(); +int ft_tokenize(t_list **alst, char *str); +int token_recognition(t_list *alst, char *str); + +#endif diff --git a/42sh/src/token/token_init.c b/42sh/src/token/token_init.c new file mode 100644 index 00000000..24f4cbd6 --- /dev/null +++ b/42sh/src/token/token_init.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* token_init.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 15:30:25 by jhalford #+# #+# */ +/* Updated: 2016/11/10 16:52:13 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "minishell.h" + +t_token *token_init(t_list **alst) +{ + t_token *token; + + token = (t_token*)malloc(sizeof(t_token) + 1); + token->type = 0; + token->size = 10; + token->data = ft_strnew(token->size); + return (token); +} diff --git a/42sh/src/token/token_recognition.c b/42sh/src/token/token_recognition.c new file mode 100644 index 00000000..6b54de41 --- /dev/null +++ b/42sh/src/token/token_recognition.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* token_recognition.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/11/10 15:37:22 by jhalford #+# #+# */ +/* Updated: 2016/11/10 15:48:45 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "token.h" + +int token_recognition(t_list *alst, char *str) +{ + +}