This commit is contained in:
Loic Deridder
2025-02-18 10:01:55 +01:00
parent 84d6079a44
commit 00d2420d9f
7 changed files with 23 additions and 6 deletions

View File

@@ -17,9 +17,16 @@ static void handle_input(char *in, t_msh *msh)
{
if (ft_strlen(in) > 0 && !is_only_space(in))
{
add_history(in);
ft_fprintf(msh->hist, "%s\n", in);
if (ft_strlen(in) != ft_strlen(msh->prev_input) ||
ft_strncmp(in, msh->prev_input, -1) != 0)
{
add_history(in);
ft_fprintf(msh->hist, "%s\n", in);
}
}
ft_free(&msh->prev_input);
if (in)
msh->prev_input = ft_strdup(in);
}
char *get_pwd(void)