line works 'normally'TM

This commit is contained in:
Maieul BOYER 2024-07-08 17:03:53 +02:00
parent 8808f81221
commit cd66370fcc
No known key found for this signature in database
4 changed files with 90 additions and 39 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
/* Updated: 2024/07/07 18:25:43 by maiboyer ### ########.fr */
/* Updated: 2024/07/08 17:02:15 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -136,7 +136,6 @@ void ft_take_args(t_utils *shcat)
free(cmd);
shcat->current_node = parse_str(&shcat->parser, shcat->str_input);
exec_shcat(shcat);
add_history(shcat->str_input);
mem_free(shcat->str_input);
}
}
@ -159,6 +158,9 @@ void free_myparser(t_parser self)
ts_parser_delete(self.parser);
}
#define IGN_START "\1"
#define IGN_END "\2"
t_i32 main(t_i32 argc, t_str argv[], t_str envp[])
{
t_utils utils;
@ -173,11 +175,11 @@ t_i32 main(t_i32 argc, t_str argv[], t_str envp[])
utils.env = create_env_map();
if (populate_env(utils.env, envp))
me_abort("Unable to build env hashmap");
utils.name_shell = "\001\x1B[93m\002"
utils.name_shell = "\x1B[93m"
"42sh"
"\001\x1B[32m\002"
"\x1B[32m"
">"
"\001\x1B[0m\002"
"\x1B[0m"
"$ ";
ft_take_args(&utils);
}

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 13:22:14 by maiboyer #+# #+# */
/* Updated: 2024/05/23 17:07:03 by maiboyer ### ########.fr */
/* Updated: 2024/07/08 15:54:21 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -23,9 +23,10 @@ void sigint_handle(int sig, siginfo_t *info, void *ucontext)
(void)(info);
(void)(ucontext);
printf("\n");
rl_replace_line("", 0);
rl_on_new_line();
rl_redisplay();
// TODO: change this to the linenoise verison
// rl_replace_line("", 0);
// rl_on_new_line();
// rl_redisplay();
}
void sigquit_handle(int sig, siginfo_t *info, void *ucontext)
@ -34,9 +35,10 @@ void sigquit_handle(int sig, siginfo_t *info, void *ucontext)
(void)(info);
(void)(ucontext);
printf("\n");
rl_replace_line("", 0);
rl_on_new_line();
rl_redisplay();
//
// rl_replace_line("", 0);
// rl_on_new_line();
// rl_redisplay();
}
void sigsegv_handle(int sig, siginfo_t *info, void *ucontext)