diff --git a/42sh/.gitignore b/42sh/.gitignore index d5fb06f4..1ecc9980 100644 --- a/42sh/.gitignore +++ b/42sh/.gitignore @@ -2,6 +2,7 @@ minishell 21sh 42sh out +STDBUG debug .42sh_history *.dSYM diff --git a/42sh/file b/42sh/file deleted file mode 100644 index 982f231a..00000000 --- a/42sh/file +++ /dev/null @@ -1,18 +0,0 @@ -4 -42sh -Makefile -Session.vim -debug -donovan_segaults_06-02 -file -file1 -file2 -file3 -includes -libft -objs -out -pdf -script.sh -src -update_makefile.sh diff --git a/42sh/libft b/42sh/libft index a82ea94e..0ca8ca81 160000 --- a/42sh/libft +++ b/42sh/libft @@ -1 +1 @@ -Subproject commit a82ea94ef7f50f8396d7bf6f9c08ab4a7faa994d +Subproject commit 0ca8ca817f32fc0345ef93ef74a3abe2583bd89c diff --git a/42sh/src/lexer/lexer_greatand.c b/42sh/src/lexer/lexer_greatand.c index d2da04ed..1c44c88e 100644 --- a/42sh/src/lexer/lexer_greatand.c +++ b/42sh/src/lexer/lexer_greatand.c @@ -21,13 +21,13 @@ int lexer_greatand(t_list **alst, t_lexer *lexer) if (ft_isdigit(lexer->str[lexer->pos])) { token_append(token, lexer, 0, 0); - lexer->str++; + lexer->pos++; return (lexer_greatand(alst, lexer)); } else if (lexer->str[lexer->pos] == '-') { token_append(token, lexer, 0, 0); - lexer->str++; + lexer->pos++; lexer->state = DEFAULT; return (lexer_lex(&(*alst)->next, lexer)); } diff --git a/42sh/src/lexer/lexer_lessand.c b/42sh/src/lexer/lexer_lessand.c index cf1547cc..f411b225 100644 --- a/42sh/src/lexer/lexer_lessand.c +++ b/42sh/src/lexer/lexer_lessand.c @@ -21,13 +21,13 @@ int lexer_lessand(t_list **alst, t_lexer *lexer) if (ft_isdigit(lexer->str[lexer->pos])) { token_append(token, lexer, 0, 0); - lexer->str++; + lexer->pos++; return (lexer_lessand(alst, lexer)); } else if (lexer->str[lexer->pos] == '-') { token_append(token, lexer, 0, 0); - lexer->str++; + lexer->pos++; lexer->state = DEFAULT; return (lexer_lex(&(*alst)->next, lexer)); } diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 8ab40dfb..09e5c839 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -53,7 +53,8 @@ int interactive_shell() token = NULL; ast = NULL; do { - ft_strappend(&lexer.str, readline(stack_to_prompt(lexer.stack))); + char *str = readline(stack_to_prompt(lexer.stack)); + ft_strappend(&lexer.str, str); if (get_lexer_stack(lexer) == BACKSLASH) pop(&lexer.stack); else if (get_lexer_stack(lexer) == DLESS) @@ -74,6 +75,7 @@ int interactive_shell() btree_print(STDBUG, ast, &ft_putast); if (ft_exec(&ast)) return (1); + DG("gonna free [%s] @ [%p]", lexer.str, lexer.str); ft_strdel(&lexer.str); return (0); }