🏗️」 wip: ctrl \ and ctrl d working

This commit is contained in:
2024-06-26 12:49:06 +02:00
parent 9980762f0c
commit 37dc7507dd
3 changed files with 26 additions and 9 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/25 12:20:26 by adjoly #+# #+# */
/* Updated: 2024/06/21 12:41:11 by adjoly ### ########.fr */
/* Updated: 2024/06/26 12:45:23 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -66,8 +66,8 @@ t_cmd *split_cmd(char *cmd_av, t_cmd *cmd);
t_quote is_inquote(char *s, size_t i);
/**
* @brief Take a character and check if it is a quote and return the
* type of quote
* @brief Take a character and check if it is a quote and return
* the type of quote
*
* @param c The character to check
*

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/18 20:14:15 by adjoly #+# #+# */
/* Updated: 2024/05/26 16:32:00 by adjoly ### ########.fr */
/* Updated: 2024/06/26 12:45:41 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -45,7 +45,9 @@ typedef struct s_token
t_redirection_sign __to_redir_sign(char *redir_sign);
/**
* @brief Take a string and split the filename and the redirect sign
* @brief Take a string and split the filename and the redirect
* sign
*
* @param redir_s A string that contain a redirection
*
* @return (t_redirection) The splited redirection

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 11:18:04 by adjoly #+# #+# */
/* Updated: 2024/06/25 17:53:36 by adjoly ### ########.fr */
/* Updated: 2024/06/26 12:48:14 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -70,6 +70,17 @@ void sigggg(int code)
rl_redisplay();
}
void siggg_backslash(int code)
{
(void)code;
}
void siggg_d(int code)
{
(void)code;
exit(EXIT_SUCCESS);
}
int main(int ac, char **av, char **env)
{
char *test;
@ -85,6 +96,8 @@ int main(int ac, char **av, char **env)
if (env_init(env, &env_l))
return (EXIT_FAILURE);
signal(SIGINT, &sigggg);
signal(SIGQUIT, &siggg_backslash);
signal(SIGSEGV, &siggg_d);
while (1)
{
prompt = get_prompt(env_l);
@ -95,18 +108,20 @@ int main(int ac, char **av, char **env)
lll = ft_split(test, ' ');
if (!*lll)
continue ;
if (is_str(test, "exit"))
else if (is_str(test, "exit"))
break ;
if (is_str(test, "pwd"))
else if (is_str(test, "pwd"))
{
ft_pwd();
continue ;
}
if (is_str(test, "cd"))
else if (is_str(test, "cd"))
{
ft_cd(&env_l, lll[1]);
continue ;
}
else if (is_str(test, "exit"))
check_quote(test);
piped = tokenizer(test);
//check_redir(((t_token *)(piped->content))->redirection, av);