fixed: splitting

This commit is contained in:
Maieul BOYER 2024-10-14 15:20:58 +02:00
parent ca8e484183
commit 135a6429ee
No known key found for this signature in database
14 changed files with 117 additions and 66 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/06 16:31:41 by rparodi #+# #+# */
/* Updated: 2024/10/12 17:52:01 by rparodi ### ########.fr */
/* Updated: 2024/10/14 15:03:01 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -67,7 +67,7 @@ void exec_shcat(t_state *state)
if (state->ast != NULL && run_program(&state->ast->data.program, state,
&prog_res))
{
printf("Error when execting the Command \n");
printf("Error when executing the cmd\n");
state->last_exit = 127;
}
ast_free(state->ast);

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
/* Updated: 2024/10/14 14:01:19 by maiboyer ### ########.fr */
/* Updated: 2024/10/14 15:13:06 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -65,18 +65,17 @@ t_error split_str_first(t_const_str s, char splitter, t_str *before,
return (NO_ERROR);
}
void append_default_env(t_hashmap_env *env)
void append_default_env(t_hashmap_env *env)
{
t_str *tmp;
t_str key;
t_str tmp2;
t_u64 shlvl;
t_str *tmp;
t_str key;
t_str tmp2;
t_u64 shlvl;
key = "SHLVL";
shlvl = 0;
tmp = hmap_env_get(env, &key);
(void)(tmp != NULL && str_to_u64(*tmp, 10, &shlvl));
(void)((tmp != NULL) && (str_free(*tmp), 1));
if (u64_to_str(shlvl + 1, &tmp2))
me_abort("Failed to set SHLVL");
hmap_env_insert(env, str_clone(key), tmp2);
@ -84,7 +83,6 @@ void append_default_env(t_hashmap_env *env)
tmp = hmap_env_get(env, &key);
if (tmp == NULL)
hmap_env_insert(env, str_clone(key), str_clone(DFT_PATH));
}
t_error populate_env(t_hashmap_env *env, t_str envp[])

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 13:22:14 by maiboyer #+# #+# */
/* Updated: 2024/10/13 17:56:04 by maiboyer ### ########.fr */
/* Updated: 2024/10/14 15:03:10 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,9 +16,9 @@
t_error install_signal(void)
{
//if (signal(SIGINT, SIG_IGN))
// return (ERROR);
//if (signal(SIGQUIT, SIG_IGN))
// return (ERROR);
if (signal(SIGINT, SIG_IGN))
return (ERROR);
if (signal(SIGQUIT, SIG_IGN))
return (ERROR);
return (NO_ERROR);
}