diff --git a/Makefile b/Makefile index d082ff5a..e39473a6 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/08/02 22:42:24 by maiboyer ### ########.fr # +# Updated: 2024/08/03 16:22:06 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -41,7 +41,7 @@ endif endif # TODO: ADD THIS WHEN FINISHING THIS: -# CFLAGS_ADDITIONAL += -DNVALGRIND +CFLAGS_ADDITIONAL += -DNVALGRIND # TODO: REMOVE THIS WHEN FINISHING THIS: CFLAGS_ADDITIONAL += -DPRINT_BACKTRACE diff --git a/exec/src/run_ast.c b/exec/src/run_ast.c index c9374343..547760db 100644 --- a/exec/src/run_ast.c +++ b/exec/src/run_ast.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/11 17:22:29 by maiboyer #+# #+# */ -/* Updated: 2024/08/03 16:13:05 by maiboyer ### ########.fr */ +/* Updated: 2024/08/03 16:20:04 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -516,6 +516,7 @@ t_error run_program(t_ast_program *self, t_state *state, t_program_result *out) ; else ; + i++; } return (ERROR); diff --git a/output/src/vec/str/str_functions2.c b/output/src/vec/str/str_functions2.c index af61b8e1..6f87845c 100644 --- a/output/src/vec/str/str_functions2.c +++ b/output/src/vec/str/str_functions2.c @@ -1,24 +1,21 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* vec_str.c :+: :+: :+: */ +/* str_functions2.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/30 17:59:28 by maiboyer #+# #+# */ -/* Updated: 2023/12/30 17:59:28 by maiboyer ### ########.fr */ +/* Updated: 2024/08/03 16:23:05 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ -#include "me/mem/mem.h" -#include "me/mem/mem.h" #include "me/mem/mem.h" #include "me/types.h" #include "me/vec/vec_str.h" #include -t_error vec_str_find(t_vec_str *vec, - bool (*fn)(const t_str *), t_usize *index) +t_error vec_str_find(t_vec_str *vec, bool (*fn)(const t_str *), t_usize *index) { t_usize idx; @@ -37,9 +34,7 @@ t_error vec_str_find(t_vec_str *vec, return (ERROR); } -t_error vec_str_find_starting(t_vec_str *vec, - bool (*fn)(const t_str *), - t_usize starting_index, t_usize *index) +t_error vec_str_find_starting(t_vec_str *vec, bool (*fn)(const t_str *), t_usize starting_index, t_usize *index) { t_usize idx; @@ -58,8 +53,7 @@ t_error vec_str_find_starting(t_vec_str *vec, return (ERROR); } -t_error vec_str_all(t_vec_str *vec, - bool (*fn)(const t_str *), bool *result) +t_error vec_str_all(t_vec_str *vec, bool (*fn)(const t_str *), bool *result) { t_usize idx; @@ -76,8 +70,7 @@ t_error vec_str_all(t_vec_str *vec, return (ERROR); } -t_error vec_str_any(t_vec_str *vec, - bool (*fn)(const t_str *), bool *result) +t_error vec_str_any(t_vec_str *vec, bool (*fn)(const t_str *), bool *result) { t_usize idx; @@ -94,10 +87,7 @@ t_error vec_str_any(t_vec_str *vec, return (ERROR); } -void vec_str_iter(t_vec_str *vec, - void (*fn)(t_usize index, t_str *value, - void *state), - void *state) +void vec_str_iter(t_vec_str *vec, void (*fn)(t_usize index, t_str *value, void *state), void *state) { t_usize idx; diff --git a/sources/env.c b/sources/env.c index 6375a256..3baf57eb 100644 --- a/sources/env.c +++ b/sources/env.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/04 18:32:50 by maiboyer #+# #+# */ -/* Updated: 2024/08/02 22:37:23 by maiboyer ### ########.fr */ +/* Updated: 2024/08/03 16:31:34 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -55,11 +55,15 @@ t_error _build_envp_iterator(t_usize idx, const t_str *key, t_str *val, { struct s_build_envp_state *s; t_str push; + t_str *nval; (void)(idx); s = ctx; + nval = hmap_env_get(s->tmp_vars, (t_str *)key); + if (nval == NULL) + nval = val; if (string_push(&s->buf, *key) || string_push(&s->buf, "=") || \ - string_push(&s->buf, *val)) + string_push(&s->buf, *nval)) return (vec_str_free(s->out), ERROR); push = str_clone(s->buf.buf); if (vec_str_push(&s->out, push)) diff --git a/sources/main.c b/sources/main.c index 2351fce6..e9718bb5 100644 --- a/sources/main.c +++ b/sources/main.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */ -/* Updated: 2024/08/03 16:16:12 by maiboyer ### ########.fr */ +/* Updated: 2024/08/03 16:18:41 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -157,6 +157,7 @@ void ft_take_args(t_state *state) line_history_add(state->str_input); state->current_node = parse_str(state); exec_shcat(state); + ft_exit(state, 42); mem_free(state->str_input); } } diff --git a/sources/signal_handler.c b/sources/signal_handler.c index 1a6d1204..3ea8550c 100644 --- a/sources/signal_handler.c +++ b/sources/signal_handler.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/02 13:22:14 by maiboyer #+# #+# */ -/* Updated: 2024/08/02 12:17:50 by rparodi ### ########.fr */ +/* Updated: 2024/08/03 16:34:19 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/stdme/src/os/process.c b/stdme/src/os/process.c index 5f5b9480..9a7a02fb 100644 --- a/stdme/src/os/process.c +++ b/stdme/src/os/process.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/03 16:22:41 by maiboyer #+# #+# */ -/* Updated: 2024/08/02 19:11:00 by maiboyer ### ########.fr */ +/* Updated: 2024/08/03 16:34:46 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,8 +27,6 @@ t_error handle_redirections(t_spawn_info *info, t_process *process); t_error spawn_process_exec(t_spawn_info info, t_process *process) { - bool res; - if (info.forked_free) info.forked_free(info.forked_free_args); dup2(info.stdin.fd.fd->fd, 0); @@ -40,11 +38,8 @@ t_error spawn_process_exec(t_spawn_info info, t_process *process) close_fd(info.stdin.fd.fd); close_fd(info.stdout.fd.fd); close_fd(info.stderr.fd.fd); - if (!vec_str_any(&info.arguments, _find_null, &res) && res) - vec_str_push(&info.arguments, NULL); - res = false; - if (!vec_str_any(&info.environement, _find_null, &res) && res) - vec_str_push(&info.environement, NULL); + vec_str_push(&info.arguments, NULL); + vec_str_push(&info.environement, NULL); execve(info.binary_path, info.arguments.buffer, info.environement.buffer); return (NO_ERROR); } diff --git a/stdme/src/str/str_split.c b/stdme/src/str/str_split.c index c899d8f5..e6f67798 100644 --- a/stdme/src/str/str_split.c +++ b/stdme/src/str/str_split.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/08/17 15:56:59 by maiboyer #+# #+# */ -/* Updated: 2024/07/30 16:11:22 by rparodi ### ########.fr */ +/* Updated: 2024/08/03 16:33:53 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -31,7 +31,7 @@ t_error str_split(t_const_str str, t_const_str chr, t_vec_str *out) while (str[idx] != '\0' && str_find_chr(chr, str[idx]) != NULL) idx++; while (str[idx] != '\0' && str_find_chr(chr, str[idx]) == NULL) - string_push_char(&buf, str[idx]); + string_push_char(&buf, str[idx++]); if (buf.len != 0) { vec_str_push(&ret, buf.buf);