fixe termcaps

This commit is contained in:
gwojda 2017-02-10 12:19:51 +01:00
parent 1167a23ca3
commit b25e6b186a
2 changed files with 9 additions and 4 deletions

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* ft_memrealloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wescande <marvin@42.fr> +#+ +:+ +#+ */
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/05 13:44:36 by wescande #+# #+# */
/* Updated: 2017/02/08 13:54:33 by wescande ### ########.fr */
/* Updated: 2017/02/10 12:13:23 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -25,6 +25,6 @@ void *ft_memrealloc(void *ptr, size_t old_s, size_t new_s)
}
n_ptr = ft_memalloc(new_s);
ft_memcpy(n_ptr, ptr, old_s);
ft_memdel(ptr);
ft_memdel(&ptr);
return (n_ptr);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */
/* Updated: 2017/02/07 17:23:02 by jhalford ### ########.fr */
/* Updated: 2017/02/10 12:16:32 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,6 +17,7 @@ extern char **environ;
int data_init(void)
{
t_data *data;
char *term_name;
data = data_singleton();
data->env = ft_sstrdup(environ);
@ -44,5 +45,9 @@ int data_init(void)
data->jobc.first_job = NULL;
data->jobc.current_id = 1;
if ((term_name = ft_getenv(data->env, "TERM")) == NULL)
return (-1);
if (tgetent(NULL, term_name) != 1)
return (-1);
return (0);
}