42-archive/42sh/src/line-editing/control_c_and_d.c
2017-03-08 17:46:38 +01:00

43 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* control_c_and_d.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/02 15:17:28 by gwojda #+# #+# */
/* Updated: 2017/03/08 17:37:21 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void ft_buff_f6(void)
{
int ret;
ret = 0;
read(0, &ret, sizeof(int));
}
void ft_control_d(void)
{
if (!STR || STR[0] == '\0')
{
ft_putstr("exit\n");
builtin_exit(NULL, (char*[]){"exit", NULL}, NULL);
}
else if (POS < ft_strlen(STR))
ft_del();
else
ft_puttermcaps("bl");
}
void ft_control_c(void)
{
ft_putchar('\n');
set_exitstatus(1, 1);
ft_prompt();
ft_strdel(&STR);
POS = 0;
}