Fixed exit builtin
This commit is contained in:
parent
ea1908e644
commit
ecf01a6b8b
3 changed files with 16 additions and 5 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/07 14:22:50 by rparodi #+# #+# */
|
/* Created: 2024/08/07 14:22:50 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/08/11 11:25:42 by maiboyer ### ########.fr */
|
/* Updated: 2024/08/11 12:49:51 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ static t_error _print_env(t_usize _idx, const t_str *key, t_str *value, void *vc
|
||||||
if (val == NULL || *val == NULL)
|
if (val == NULL || *val == NULL)
|
||||||
return (NO_ERROR);
|
return (NO_ERROR);
|
||||||
// TODO: Fix this to handle the corrrect output
|
// TODO: Fix this to handle the corrrect output
|
||||||
me_printf_fd(NULL, "%s=%s\n", *key, *val);
|
me_printf_fd(ctx->info->stdout, "%s=%s\n", *key, *val);
|
||||||
return (NO_ERROR);
|
return (NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/10 18:43:18 by maiboyer #+# #+# */
|
/* Created: 2024/08/10 18:43:18 by maiboyer #+# #+# */
|
||||||
/* Updated: 2024/08/11 11:26:03 by maiboyer ### ########.fr */
|
/* Updated: 2024/08/11 12:41:07 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ t_error builtin_exit__(t_state *state, t_builtin_spawn_info info, t_i32 *exit_co
|
||||||
if (info.args.len < 2)
|
if (info.args.len < 2)
|
||||||
actual_exit_code = 0;
|
actual_exit_code = 0;
|
||||||
else if (str_to_i32(info.args.buffer[1], 10, &actual_exit_code))
|
else if (str_to_i32(info.args.buffer[1], 10, &actual_exit_code))
|
||||||
return (ERROR);
|
return (printf("info.args.buffer[1] = %s\n", info.args.buffer[1]), ERROR);
|
||||||
*exit_code = actual_exit_code;
|
*exit_code = actual_exit_code;
|
||||||
me_exit(actual_exit_code);
|
me_exit(actual_exit_code);
|
||||||
return (NO_ERROR);
|
return (NO_ERROR);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/11 17:22:29 by maiboyer #+# #+# */
|
/* Created: 2024/07/11 17:22:29 by maiboyer #+# #+# */
|
||||||
/* Updated: 2024/08/11 12:19:11 by maiboyer ### ########.fr */
|
/* Updated: 2024/08/11 12:48:42 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -452,6 +452,14 @@ t_error _word_into_str(t_ast_node self, t_state *state, t_vec_str *append)
|
||||||
return (NO_ERROR);
|
return (NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t_error _raw_str_into_str(t_ast_node self, t_state *state, t_vec_str *append)
|
||||||
|
{
|
||||||
|
if (self == NULL || state == NULL || append == NULL || self->kind != AST_RAW_STRING)
|
||||||
|
return (ERROR);
|
||||||
|
vec_str_push(append, str_clone(self->data.raw_string.str));
|
||||||
|
return (NO_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
t_error _ast_into_str(t_ast_node self, t_state *state, t_vec_str *append)
|
t_error _ast_into_str(t_ast_node self, t_state *state, t_vec_str *append)
|
||||||
{
|
{
|
||||||
if (self == NULL || state == NULL || append == NULL)
|
if (self == NULL || state == NULL || append == NULL)
|
||||||
|
|
@ -464,6 +472,9 @@ t_error _ast_into_str(t_ast_node self, t_state *state, t_vec_str *append)
|
||||||
return (_cmd_into_str(self, state, append));
|
return (_cmd_into_str(self, state, append));
|
||||||
if (self->kind == AST_WORD)
|
if (self->kind == AST_WORD)
|
||||||
return (_word_into_str(self, state, append));
|
return (_word_into_str(self, state, append));
|
||||||
|
if (self->kind == AST_RAW_STRING)
|
||||||
|
return (_raw_str_into_str(self, state, append));
|
||||||
|
printf("unknown Kind = %#04x\n", self->kind);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue