diff --git a/Makefile b/Makefile index 1ede6999..5df6d944 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/10/14 15:20:12 by maiboyer ### ########.fr # +# Updated: 2024/10/23 14:49:04 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -49,8 +49,8 @@ CFLAGS_ADDITIONAL += -DNVALGRIND # TODO: REMOVE THIS WHEN FINISHING THIS: # CFLAGS_ADDITIONAL += -fsanitize=memory -fno-omit-frame-pointer -fsanitize-memory-track-origins #-fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--allow-multiple # CFLAGS_ADDITIONAL += -O0 -# CFLAGS_ADDITIONAL += -Wno-cpp -Wno-type-limits -Wno-unused-command-line-argument -# CFLAGS_ADDITIONAL += -gcolumn-info -g3 -fno-builtin +# CFLAGS_ADDITIONAL += -Wno-cpp -Wno-type-limits +CFLAGS_ADDITIONAL += -gcolumn-info -g3 -fno-builtin # CFLAGS_ADDITIONAL += '-DERROR=((void)printf("ERROR HERE: " __FILE__ ":%d in %s\n", __LINE__, __func__), 1)' # CFLAGS_ADDITIONAL += -O2 # CFLAGS_ADDITIONAL += -fuse-ld=gold -Wl,--print-symbol-counts -Wl,/tmp/symbols_count.log diff --git a/Minishell.mk b/Minishell.mk index 2223face..08b62be3 100644 --- a/Minishell.mk +++ b/Minishell.mk @@ -31,7 +31,7 @@ export BASE_PATH export BUILD_DIR # Flags -CFLAGS = -Werror -Wextra -Wall -Wno-unused-command-line-argument -MMD -I./includes -I./output/include -I./stdme/output/include -rdynamic -Wl,-E +CFLAGS = -Werror -Wextra -Wall -MMD -I./includes -I./output/include -I./stdme/output/include CFLAGS += $(CFLAGS_ADDITIONAL) diff --git a/allocator/Filelist.aq.mk b/allocator/Filelist.aq.mk index ead60e1c..1237472a 100644 --- a/allocator/Filelist.aq.mk +++ b/allocator/Filelist.aq.mk @@ -3,7 +3,6 @@ lc_alloc/functions1 \ lc_alloc/functions2 \ me_alloc/find_block \ me_alloc/functions1 \ -me_alloc/functions2 \ me_alloc/internals \ me_alloc/merge_blocks \ me_alloc/pages \ diff --git a/allocator/Makefile b/allocator/Makefile index aa4d14e5..b1941065 100644 --- a/allocator/Makefile +++ b/allocator/Makefile @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/08/02 18:57:11 by maiboyer ### ########.fr # +# Updated: 2024/10/23 14:48:39 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -22,7 +22,7 @@ NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang -CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' +CFLAGS = -Wall -Werror -Wextra -MMD -DBASE_PATH='"$(BASE_PATH)/"' CFLAGS += $(CFLAGS_ADDITIONAL) LIBS_NAME = diff --git a/allocator/src/lc_alloc/functions1.c b/allocator/src/lc_alloc/functions1.c index 9280f9d2..949582af 100644 --- a/allocator/src/lc_alloc/functions1.c +++ b/allocator/src/lc_alloc/functions1.c @@ -14,39 +14,39 @@ #include "aq/libc_wrapper.h" #include "me/types.h" -void *__libc_malloc(t_usize size); -void *__libc_calloc(t_usize size, t_usize elem); -void *__libc_realloc(void *ptr, t_usize size); -void *__libc_reallocarray(void *ptr, t_usize size, t_usize elem); -void __libc_free(void *ptr); +void *malloc(t_usize size); +void *calloc(t_usize size, t_usize elem); +void *realloc(void *ptr, t_usize size); +void *reallocarray(void *ptr, t_usize size, t_usize elem); +void free(void *ptr); void *lc_malloc(t_allocator *self, t_usize size) { (void)(self); - return (__libc_malloc(size)); + return (malloc(size)); } void *lc_calloc(t_allocator *self, t_usize size, t_usize elem) { (void)(self); - return (__libc_calloc(size, elem)); + return (calloc(size, elem)); } void *lc_realloc(t_allocator *self, void *ptr, t_usize size) { (void)(self); - return (__libc_realloc(ptr, size)); + return (realloc(ptr, size)); } void *lc_realloc_array(t_allocator *self, void *ptr, t_usize size, t_usize elem) { (void)(self); - return (__libc_reallocarray(ptr, size, elem)); + return (reallocarray(ptr, size, elem)); } void lc_free(t_allocator *self, void *ptr) { (void)(self); - return (__libc_free(ptr)); + return (free(ptr)); } diff --git a/allocator/src/me_alloc/functions1.c b/allocator/src/me_alloc/functions1.c index 7af4847b..427bd30a 100644 --- a/allocator/src/me_alloc/functions1.c +++ b/allocator/src/me_alloc/functions1.c @@ -18,8 +18,8 @@ #include #include -void *__libc_malloc(t_usize size); -void __libc_free(void *ptr); +void *malloc(t_usize size); +void free(void *ptr); void *m_malloc(struct s_allocator_melloc *self, t_usize size) { @@ -64,14 +64,14 @@ void m_uninit(struct s_allocator_melloc *self) if (list->pages[idx].data != NULL) { vg_mempool_free(list, list->pages[idx].data); - __libc_free(list->pages[idx].data); + free(list->pages[idx].data); list->pages[idx].size = 0; list->pages[idx].data = NULL; } idx++; } list_next = list->next; - (__libc_free(list), vg_mempool_destroy(list), \ + (free(list), vg_mempool_destroy(list), \ vg_mem_no_access(list, sizeof(*list))); list = list_next; } diff --git a/allocator/src/me_alloc/functions2.c b/allocator/src/me_alloc/functions2.c deleted file mode 100644 index a91a035b..00000000 --- a/allocator/src/me_alloc/functions2.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* functions2.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: maiboyer +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/05/14 18:06:34 by maiboyer #+# #+# */ -/* Updated: 2024/10/12 17:51:05 by rparodi ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "aq/allocator.h" -#include "aq/libc_wrapper.h" - -// void lc_uninit(t_allocator *self) -// { -// (void)(self); -// } diff --git a/allocator/src/me_alloc/pages.c b/allocator/src/me_alloc/pages.c index e2cc978b..9e17e7a9 100644 --- a/allocator/src/me_alloc/pages.c +++ b/allocator/src/me_alloc/pages.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/10 16:51:10 by maiboyer #+# #+# */ -/* Updated: 2024/10/12 17:51:07 by rparodi ### ########.fr */ +/* Updated: 2024/10/23 14:52:47 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,8 +17,8 @@ #include "me/types.h" #include -void *__libc_malloc(t_usize size); -void __libc_free(void *ptr); +void *malloc(t_usize size); +void free(void *ptr); t_error alloc_page_list(t_page_list **out) { @@ -26,7 +26,7 @@ t_error alloc_page_list(t_page_list **out) if (out == NULL) return (ERROR); - val = __libc_malloc(sizeof(*val)); + val = malloc(sizeof(*val)); if (val == NULL) return (ERROR); mem_set_zero(val, sizeof(*val)); @@ -43,10 +43,10 @@ t_error _alloc_new_page_inner(t_usize page_size, t_page_list *list) if (list == NULL) return (ERROR); vg_mem_defined(list, sizeof(*list)); - list->pages[list->len].data = __libc_malloc(page_size); - mem_set_zero(list->pages[list->len].data, page_size); + list->pages[list->len].data = malloc(page_size); if (list->pages[list->len].data == NULL) return (ERROR); + mem_set_zero(list->pages[list->len].data, page_size); list->pages[list->len].size = page_size; vg_mempool_alloc(list, list->pages[list->len].data, page_size); chunk = get_first_block(&list->pages[list->len]); diff --git a/ast/Filelist.ast.mk b/ast/Filelist.ast.mk index f0254bfb..ca332e85 100644 --- a/ast/Filelist.ast.mk +++ b/ast/Filelist.ast.mk @@ -6,9 +6,9 @@ ast_free/ast_free_scripting \ print_ast/ast_print \ print_ast/ast_print_arithmetic \ print_ast/ast_print_command \ +print_ast/ast_print_general \ print_ast/ast_print_global \ print_ast/ast_print_helper_function \ print_ast/ast_print_node \ print_ast/ast_print_redirection \ -print_ast/ast_print_subshell \ diff --git a/ast/Makefile b/ast/Makefile index fb07427a..601f70ad 100644 --- a/ast/Makefile +++ b/ast/Makefile @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/08/02 18:58:20 by maiboyer ### ########.fr # +# Updated: 2024/10/23 14:48:35 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -25,7 +25,7 @@ NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang -CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' +CFLAGS = -Wall -Werror -Wextra -MMD -DBASE_PATH='"$(BASE_PATH)/"' CFLAGS += $(CFLAGS_ADDITIONAL) diff --git a/ast/src/print_ast/ast_print_subshell.c b/ast/src/print_ast/ast_print_general.c similarity index 97% rename from ast/src/print_ast/ast_print_subshell.c rename to ast/src/print_ast/ast_print_general.c index f82d3bd9..5d7cc619 100644 --- a/ast/src/print_ast/ast_print_subshell.c +++ b/ast/src/print_ast/ast_print_general.c @@ -1,7 +1,7 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* ast_print_subshell.c :+: :+: :+: */ +/* ast_print_general.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ diff --git a/ast/src/print_ast/ast_print_redirection.c b/ast/src/print_ast/ast_print_redirection.c index 3d480316..12b17ee9 100644 --- a/ast/src/print_ast/ast_print_redirection.c +++ b/ast/src/print_ast/ast_print_redirection.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/26 13:07:12 by rparodi #+# #+# */ -/* Updated: 2024/10/14 14:12:49 by maiboyer ### ########.fr */ +/* Updated: 2024/10/24 23:04:06 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,9 @@ void ast_print_node_file_redirection_heredoc(t_ast_node self) { - (void)(self); + if (self == NULL || self->kind != AST_HEREDOC_REDIRECTION) + return ; + printf("<<%s ", self->data.heredoc_redirection.delimiter); } //{ // if (self->data.file_redirection.op == AST_REDIR_HEREDOC) diff --git a/exec/Makefile b/exec/Makefile index 08ee7d17..5c8a973f 100644 --- a/exec/Makefile +++ b/exec/Makefile @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/08/02 18:58:14 by maiboyer ### ########.fr # +# Updated: 2024/10/23 14:48:20 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -22,7 +22,7 @@ NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang -CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' +CFLAGS = -Wall -Werror -Wextra -MMD -DBASE_PATH='"$(BASE_PATH)/"' CFLAGS += $(CFLAGS_ADDITIONAL) -include Filelist.$(ANAME).mk diff --git a/exec/src/_read_dir.c b/exec/src/_read_dir.c index 6efa76e6..d545844e 100644 --- a/exec/src/_read_dir.c +++ b/exec/src/_read_dir.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/17 21:43:33 by rparodi #+# #+# */ -/* Updated: 2024/10/12 17:51:19 by rparodi ### ########.fr */ +/* Updated: 2024/10/23 15:33:10 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -58,6 +58,7 @@ t_error listing_files(t_string path, t_vec_str *out) continue ; vec_str_push(&ret, str_clone(entry->d_name)); } + close_dir(tmp); return (*out = ret, NO_ERROR); } diff --git a/exec/src/builtins/export.c b/exec/src/builtins/export.c index 3bd5c218..59e6bdf4 100644 --- a/exec/src/builtins/export.c +++ b/exec/src/builtins/export.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/07 14:13:41 by rparodi #+# #+# */ -/* Updated: 2024/10/13 17:24:39 by maiboyer ### ########.fr */ +/* Updated: 2024/10/23 16:05:55 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,11 +17,29 @@ #include "me/string/string.h" #include "me/types.h" #include "me/vec/vec_str.h" +#include "me/char/char.h" +#define CHARSET_LETTER "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" +#define CHARSET_NUMBER "0123456789" t_error _append_key_to_vec(t_usize _, const t_str *key, t_str *v, void *vec); bool _sort_str(t_str *_lhs, t_str *_rhs); t_error get_uniq_keys(t_state *state, t_vec_str *out); +bool is_valid_name(t_str arg) +{ + size_t i; + + i = 0; + if (!str_find_chr(CHARSET_LETTER, arg[0])) + return (false); + while (arg[i] != '\0') + { + if (!str_find_chr(CHARSET_LETTER CHARSET_NUMBER, arg[i++])) + return (false); + } + return (true); +} + static void _assign_export(t_usize idx, t_str *arg, void *vctx) { struct s_assign_export_state *ctx; @@ -34,11 +52,15 @@ static void _assign_export(t_usize idx, t_str *arg, void *vctx) ctx = vctx; first_eq = str_find_chr(*arg, '='); if (first_eq == NULL || first_eq == *arg) + { hmap_env_insert(ctx->state->env, *arg, NULL); + return ; + } key = str_substring(*arg, 0, first_eq - *arg); + if (!is_valid_name(key)) + return ; value = str_substring(first_eq, 1, ~0llu); - if (hmap_env_insert(ctx->state->env, key, value)) - ctx->err = ERROR; + hmap_env_insert(ctx->state->env, key, value); } static t_error handle_quotes(t_str raw, t_string *out) diff --git a/exec/src/run_ast/_ast_into_str_main.c b/exec/src/run_ast/_ast_into_str_main.c index 723c5212..914e6702 100644 --- a/exec/src/run_ast/_ast_into_str_main.c +++ b/exec/src/run_ast/_ast_into_str_main.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/14 12:26:51 by maiboyer #+# #+# */ -/* Updated: 2024/10/15 21:30:02 by maiboyer ### ########.fr */ +/* Updated: 2024/10/28 11:42:11 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,29 +21,29 @@ t_error _word_handle_star(t_ast_word *word, t_state *state, t_vec_str *out); t_error list_files_in_current_directory(t_vec_str *out); t_error _word_into_str_inner(struct s_word_str_args args); -t_error _word_split_loop(\ - bool do_split, t_expandable_str val, t_vec_str *append, t_string *tmp) +t_error _word_split_loop_expand(\ + t_expandable_str val, t_vec_str *append, t_string *tmp, bool *exist) { t_vec_str split; t_str stmp; - if (do_split) + if (val.do_expand && str_find_chr(val.value, ' ')) { - if (val.do_expand) + if (val.value == NULL) + val.value = ""; + if (str_split(val.value, " \t\n\r\v", &split)) + return (ERROR); + if (split.len != 0 && tmp->len != 0) { - if (val.value == NULL) - val.value = ""; - if (str_split(val.value, " ", &split)) - return (ERROR); - while (!vec_str_pop_front(&split, &stmp)) - vec_str_push(append, stmp); - vec_str_free(split); + vec_str_push(append, tmp->buf); + *tmp = string_new(16); } - else - vec_str_push(append, str_clone(val.value)); + while (!vec_str_pop_front(&split, &stmp)) + vec_str_push(append, stmp); + vec_str_free(split); } else - string_push(tmp, val.value); + *exist = (string_push(tmp, val.value), true); return (NO_ERROR); } @@ -52,15 +52,23 @@ t_error _word_split(\ { t_string tmp; t_usize i; + bool exist; tmp = string_new(64); i = 0; + exist = false; while (i < res->value.len) { - if (_word_split_loop(do_split, res->value.buffer[i++], append, &tmp)) - return (string_free(tmp), ERROR); + if (do_split) + _word_split_loop_expand(res->value.buffer[i], append, &tmp, &exist); + else + { + string_push(&tmp, res->value.buffer[i].value); + exist = true; + } + i++; } - if (!do_split) + if (!do_split || tmp.len != 0 || exist) vec_str_push(append, tmp.buf); else string_free(tmp); diff --git a/exec/src/run_ast/_ast_into_str_star.c b/exec/src/run_ast/_ast_into_str_star.c index 0bf0043c..a08037f7 100644 --- a/exec/src/run_ast/_ast_into_str_star.c +++ b/exec/src/run_ast/_ast_into_str_star.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/14 12:26:51 by maiboyer #+# #+# */ -/* Updated: 2024/10/12 17:51:22 by rparodi ### ########.fr */ +/* Updated: 2024/10/25 15:52:50 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,31 @@ bool _word_is_star(t_ast_word *word) { return (BONUS && word->kind == AST_WORD_NO_QUOTE && word->inner.len == 1 \ && word->inner.buffer[0]->kind == AST_RAW_STRING \ - && str_compare("*", word->inner.buffer[0]->data.raw_string.str)); + && str_find_chr(word->inner.buffer[0]->data.raw_string.str, '*') != NULL); +} + +bool match(t_const_str pattern, t_const_str str) +{ + while (*pattern) + { + if (*pattern == '*') + { + if (!*(pattern + 1)) + return (true); + while (*str) + { + if (match(pattern + 1, str)) + return (true); + str++; + } + return (false); + } + else if (*pattern != *str) + return (false); + pattern++; + str++; + } + return (!*pattern && !*str); } t_error _word_handle_star(t_ast_word *word, t_state *state, t_vec_str *out) @@ -35,7 +59,12 @@ t_error _word_handle_star(t_ast_word *word, t_state *state, t_vec_str *out) if (list_files_in_current_directory(&files)) return (ERROR); while (!vec_str_pop_front(&files, &s)) - vec_str_push(out, s); + { + if (match(word->inner.buffer[0]->data.raw_string.str, s)) + vec_str_push(out, s); + else + str_free(s); + } vec_str_free(files); return (NO_ERROR); } diff --git a/exec/src/run_ast/_spawn_cmd.c b/exec/src/run_ast/_spawn_cmd.c index e830e3af..c53b0a9f 100644 --- a/exec/src/run_ast/_spawn_cmd.c +++ b/exec/src/run_ast/_spawn_cmd.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/14 12:30:09 by maiboyer #+# #+# */ -/* Updated: 2024/10/14 15:07:42 by maiboyer ### ########.fr */ +/* Updated: 2024/10/24 22:57:49 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -79,6 +79,7 @@ t_error _spawn_cmd_and_run_end(\ bpath = str_clone(info.binary_path); if (spawn_process(info, &out->process)) return (close_fd(cmd_pipe.input), out->exit = 127, _err_cmd(bpath)); + close_fd(cmd_pipe.input); str_free(bpath); if (cmd_pipe.create_output || cmd_pipe.input != NULL) return (out->exit = -1, NO_ERROR); diff --git a/exec/src/run_ast/run_list.c b/exec/src/run_ast/run_list.c index 6d9a74dd..ee2bbb92 100644 --- a/exec/src/run_ast/run_list.c +++ b/exec/src/run_ast/run_list.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/14 12:34:33 by maiboyer #+# #+# */ -/* Updated: 2024/10/12 17:51:26 by rparodi ### ########.fr */ +/* Updated: 2024/10/23 15:01:54 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -46,12 +46,12 @@ t_error run_list(t_ast_list *list, t_state *state, t_list_result *out) left = -1; right = -1; if (_run_get_exit_code(list->left, state, &left)) - return (ERROR); + left = 127; if ((list->op == AST_LIST_OR && left != 0) || (list->op == AST_LIST_AND && left == 0)) { if (_run_get_exit_code(list->right, state, &right)) - return (ERROR); + right = 127; out->exit = right; } else diff --git a/exec/src/run_ast/run_subshell.c b/exec/src/run_ast/run_subshell.c index 87827d61..8f10b2b2 100644 --- a/exec/src/run_ast/run_subshell.c +++ b/exec/src/run_ast/run_subshell.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/14 12:35:02 by maiboyer #+# #+# */ -/* Updated: 2024/10/13 17:24:55 by maiboyer ### ########.fr */ +/* Updated: 2024/10/23 15:31:55 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/line/Makefile b/line/Makefile index f55fe80d..8665d803 100644 --- a/line/Makefile +++ b/line/Makefile @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/08/02 18:58:07 by maiboyer ### ########.fr # +# Updated: 2024/10/23 14:48:29 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -22,7 +22,7 @@ NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang -CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -g3 +CFLAGS = -Wall -Werror -Wextra -MMD -DBASE_PATH='"$(BASE_PATH)/"' CFLAGS += $(CFLAGS_ADDITIONAL) -include Filelist.$(ANAME).mk diff --git a/parser/src/yard/yard.c b/parser/src/yard/yard.c index 049d6961..a11a458e 100644 --- a/parser/src/yard/yard.c +++ b/parser/src/yard/yard.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/07 18:04:13 by rparodi #+# #+# */ -/* Updated: 2024/10/12 17:51:57 by rparodi ### ########.fr */ +/* Updated: 2024/10/23 15:30:59 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -44,8 +44,8 @@ t_error _yard_parenthesis(\ vec_token_pop(stack, &tok); token_free(tok); snode = ast_alloc(AST_SUBSHELL); - vec_ast_pop(output_queue, &tmp); - vec_ast_push(&snode->data.subshell.body, tmp); + if (!vec_ast_pop(output_queue, &tmp)) + vec_ast_push(&snode->data.subshell.body, tmp); vec_ast_push(output_queue, snode); return (NO_ERROR); } diff --git a/sources/_helper_main.c b/sources/_helper_main.c index f6fda511..adf3c0d0 100644 --- a/sources/_helper_main.c +++ b/sources/_helper_main.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/09/06 16:31:41 by rparodi #+# #+# */ -/* Updated: 2024/10/14 15:03:01 by maiboyer ### ########.fr */ +/* Updated: 2024/10/24 23:02:59 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -67,7 +67,6 @@ void exec_shcat(t_state *state) if (state->ast != NULL && run_program(&state->ast->data.program, state, &prog_res)) { - printf("Error when executing the cmd\n"); state->last_exit = 127; } ast_free(state->ast); diff --git a/stdme/Makefile b/stdme/Makefile index 586bf7f3..d86ea854 100644 --- a/stdme/Makefile +++ b/stdme/Makefile @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/08/02 18:57:39 by maiboyer ### ########.fr # +# Updated: 2024/10/23 14:48:53 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -25,7 +25,7 @@ NAME = libme.a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang -CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' +CFLAGS = -Wall -Werror -Wextra -MMD -DBASE_PATH='"$(BASE_PATH)/"' CFLAGS += $(CFLAGS_ADDITIONAL) -include ./Filelist.$(ANAME).mk