Added more string utils and line stuff

This commit is contained in:
Maix0 2024-07-08 22:27:26 +02:00
parent 13ba83d6af
commit 6b5bc68de9
9 changed files with 229 additions and 151 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/08 17:02:15 by maiboyer ### ########.fr */
/* Updated: 2024/07/08 21:11:43 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -132,8 +132,8 @@ void ft_take_args(t_utils *shcat)
cmd = linenoise((t_const_str)shcat->name_shell);
if (cmd == NULL)
ft_exit(shcat, 0);
shcat->str_input = str_clone(cmd);
free(cmd);
shcat->str_input = cmd;
linenoise_history_add(shcat->str_input);
shcat->current_node = parse_str(&shcat->parser, shcat->str_input);
exec_shcat(shcat);
mem_free(shcat->str_input);

View file

@ -6,14 +6,14 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/02 13:22:14 by maiboyer #+# #+# */
/* Updated: 2024/07/08 15:54:21 by maiboyer ### ########.fr */
/* Updated: 2024/07/08 21:19:35 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "app/signal_handler.h"
#include "me/fs/fs.h"
#include "me/printf/printf.h"
#include "me/types.h"
#include "readline/readline.h"
#include <stdio.h>
#include <stdlib.h>
@ -22,7 +22,7 @@ void sigint_handle(int sig, siginfo_t *info, void *ucontext)
(void)(sig);
(void)(info);
(void)(ucontext);
printf("\n");
write_fd(get_stdout(), (void *)"\n", 1, NULL);
// TODO: change this to the linenoise verison
// rl_replace_line("", 0);
// rl_on_new_line();
@ -34,8 +34,7 @@ void sigquit_handle(int sig, siginfo_t *info, void *ucontext)
(void)(sig);
(void)(info);
(void)(ucontext);
printf("\n");
//
write_fd(get_stdout(), (void *)"\n", 1, NULL);
// rl_replace_line("", 0);
// rl_on_new_line();
// rl_redisplay();