commit
00cba8ea4d
23 changed files with 44 additions and 41 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/21 16:32:26 by jhalford #+# #+# */
|
/* Created: 2017/03/21 16:32:26 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 16:40:17 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 16:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 14:29:17 by jhalford #+# #+# */
|
/* Created: 2016/11/28 14:29:17 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 14:40:05 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 17:40:31 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/03 13:37:49 by jhalford #+# #+# */
|
/* Created: 2016/12/03 13:37:49 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 15:11:09 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 17:40:28 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 16:40:13 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 17:40:35 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 22:12:31 by jhalford #+# #+# */
|
/* Created: 2017/02/06 22:12:31 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 16:35:42 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 17:40:36 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/31 22:18:46 by wescande #+# #+# */
|
/* Created: 2017/01/31 22:18:46 by wescande #+# #+# */
|
||||||
/* Updated: 2017/02/24 22:05:41 by ariard ### ########.fr */
|
/* Updated: 2017/03/21 18:13:25 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ unsigned char **ft_strsplit_esc(const char *str,
|
||||||
|
|
||||||
if ((pos = -1) && !str)
|
if ((pos = -1) && !str)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (!(s1 = (unsigned char **)malloc(sizeof(*s1) * (nb_c(str, esc, c) + 1))))
|
if (!(s1 = (unsigned char **)ft_malloc(sizeof(*s1) * (nb_c(str, esc, c) + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = 0;
|
i = 0;
|
||||||
fix = str;
|
fix = str;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/31 20:49:30 by wescande #+# #+# */
|
/* Created: 2017/01/31 20:49:30 by wescande #+# #+# */
|
||||||
/* Updated: 2017/02/24 22:03:22 by ariard ### ########.fr */
|
/* Updated: 2017/03/21 18:13:34 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ char **ft_strsplit_spe(const char *str,
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (!str || !(s1 =
|
if (!str || !(s1 =
|
||||||
(char**)malloc(sizeof(*s1) * (ft_nbstr_c(str, esc, c) + 1))))
|
(char**)ft_malloc(sizeof(*s1) * (ft_nbstr_c(str, esc, c) + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = 0;
|
i = 0;
|
||||||
fix = str;
|
fix = str;
|
||||||
|
|
@ -72,7 +72,7 @@ char **ft_strsplit_spe(const char *str,
|
||||||
++str;
|
++str;
|
||||||
while (*str && (len = ft_strlen_c(str, fix, esc, c)))
|
while (*str && (len = ft_strlen_c(str, fix, esc, c)))
|
||||||
{
|
{
|
||||||
if (!(s1[i] = (char*)malloc(sizeof(**s1) * (len + 1))))
|
if (!(s1[i] = (char*)ft_malloc(sizeof(**s1) * (len + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
ft_strncpy(s1[i], str, len);
|
ft_strncpy(s1[i], str, len);
|
||||||
s1[i][len] = '\0';
|
s1[i][len] = '\0';
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 20:04:40 by wescande #+# #+# */
|
/* Created: 2017/03/07 20:04:40 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/07 21:14:55 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 18:13:39 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ char **gen_tab(const char *pat,
|
||||||
char **my_tab;
|
char **my_tab;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (!(my_tab = (char **)malloc(sizeof(char *) * (esc2 ? 4 : 3))))
|
if (!(my_tab = (char **)ft_malloc(sizeof(char *) * (esc2 ? 4 : 3))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (dup)
|
if (dup)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/01 18:17:34 by wescande #+# #+# */
|
/* Created: 2016/12/01 18:17:34 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/07 21:17:20 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 18:12:52 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ void ft_ld_new(t_ld **alst, void *content)
|
||||||
{
|
{
|
||||||
t_ld *new;
|
t_ld *new;
|
||||||
|
|
||||||
if ((new = (t_ld *)malloc(sizeof(t_ld))))
|
if ((new = (t_ld *)ft_malloc(sizeof(t_ld))))
|
||||||
{
|
{
|
||||||
new->content = content;
|
new->content = content;
|
||||||
new->prev = NULL;
|
new->prev = NULL;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/16 15:59:38 by wescande #+# #+# */
|
/* Created: 2016/12/16 15:59:38 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/07 21:17:28 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 18:12:58 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ void ft_ld_pushback(t_ld **alst, void *content)
|
||||||
|
|
||||||
if (!alst || !*alst)
|
if (!alst || !*alst)
|
||||||
return (ft_ld_new(alst, content));
|
return (ft_ld_new(alst, content));
|
||||||
if ((new = (t_ld *)malloc(sizeof(t_ld))))
|
if ((new = (t_ld *)ft_malloc(sizeof(t_ld))))
|
||||||
{
|
{
|
||||||
back = ft_ld_back(*alst);
|
back = ft_ld_back(*alst);
|
||||||
new->prev = back;
|
new->prev = back;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/01 18:32:40 by wescande #+# #+# */
|
/* Created: 2016/12/01 18:32:40 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/07 21:15:42 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 18:13:02 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ void ft_ld_pushfront(t_ld **alst, void *content)
|
||||||
|
|
||||||
if (!alst || !*alst)
|
if (!alst || !*alst)
|
||||||
return (ft_ld_new(alst, content));
|
return (ft_ld_new(alst, content));
|
||||||
if ((new = (t_ld *)malloc(sizeof(t_ld))))
|
if ((new = (t_ld *)ft_malloc(sizeof(t_ld))))
|
||||||
{
|
{
|
||||||
front = ft_ld_front(*alst);
|
front = ft_ld_front(*alst);
|
||||||
new->next = front;
|
new->next = front;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/05 16:17:00 by wescande #+# #+# */
|
/* Created: 2017/01/05 16:17:00 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/07 21:20:05 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 18:13:08 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ char **ft_ld_to_tab(t_ld *ld)
|
||||||
if (!ld)
|
if (!ld)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
nb_item = ft_ld_size(ld);
|
nb_item = ft_ld_size(ld);
|
||||||
if (!(my_tab = (char **)malloc(sizeof(char *) * (nb_item + 1))))
|
if (!(my_tab = (char **)ft_malloc(sizeof(char *) * (nb_item + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
index = 0;
|
index = 0;
|
||||||
while (ld)
|
while (ld)
|
||||||
|
|
|
||||||
|
|
@ -6,19 +6,22 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/18 11:20:11 by gwojda #+# #+# */
|
/* Created: 2017/02/18 11:20:11 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/19 16:40:25 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 17:40:13 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "minishell.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
|
#define BACKUP_PATH "/bin:/usr/bin"
|
||||||
|
|
||||||
char *ft_add_hash(char *cmd)
|
char *ft_add_hash(char *cmd)
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
t_hash hash;
|
t_hash hash;
|
||||||
|
char *path;
|
||||||
|
|
||||||
if (!(hash.path = ft_findexec(ft_getenv(
|
path = ft_getenv(data_singleton()->env, "PATH");
|
||||||
data_singleton()->env, "PATH"), cmd)))
|
if (!(hash.path = ft_findexec(path ? path : BACKUP_PATH, cmd)))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
hash.key = ft_strdup(cmd);
|
hash.key = ft_strdup(cmd);
|
||||||
id = ft_hash_str(cmd);
|
id = ft_hash_str(cmd);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/18 11:06:19 by gwojda #+# #+# */
|
/* Created: 2017/02/18 11:06:19 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/19 16:38:12 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 17:40:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/18 11:08:40 by gwojda #+# #+# */
|
/* Created: 2017/02/18 11:08:40 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/19 16:39:18 by wescande ### ########.fr */
|
/* Updated: 2017/03/21 17:40:20 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */
|
/* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/21 13:37:25 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 18:12:27 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ t_list_history *ft_create_history_list(char *str)
|
||||||
{
|
{
|
||||||
t_list_history *list;
|
t_list_history *list;
|
||||||
|
|
||||||
list = (t_list_history *)malloc(sizeof(t_list_history));
|
list = (t_list_history *)ft_malloc(sizeof(t_list_history));
|
||||||
if (!list)
|
if (!list)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (!str)
|
if (!str)
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* token_init.c :+: :+: :+: */
|
/* token_init.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/10 15:30:25 by jhalford #+# #+# */
|
/* Created: 2016/11/10 15:30:25 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/16 19:07:52 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 18:11:43 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ t_token *token_init(void)
|
||||||
{
|
{
|
||||||
t_token *token;
|
t_token *token;
|
||||||
|
|
||||||
if (!(token = (t_token *)malloc(sizeof(t_token))))
|
if (!(token = (t_token *)ft_malloc(sizeof(t_token))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
token->type = 0;
|
token->type = 0;
|
||||||
token->size = 8;
|
token->size = 8;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/19 12:45:06 by gwojda #+# #+# */
|
/* Created: 2016/12/19 12:45:06 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/21 10:32:34 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 18:11:14 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ static char *ft_strdupi_space(char const *s)
|
||||||
++i;
|
++i;
|
||||||
if (s[i] == '\n')
|
if (s[i] == '\n')
|
||||||
++i;
|
++i;
|
||||||
if (!(str = (char *)malloc(sizeof(char) * (i + 1))))
|
if (!(str = (char *)ft_malloc(sizeof(char) * (i + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 17:33:41 by gwojda #+# #+# */
|
/* Created: 2017/03/07 17:33:41 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/07 17:36:38 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 18:11:13 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ struct termios *ft_save_termios(int save)
|
||||||
}
|
}
|
||||||
if (save > 0)
|
if (save > 0)
|
||||||
{
|
{
|
||||||
term_save = (struct termios *)malloc(sizeof(struct termios));
|
term_save = (struct termios *)ft_malloc(sizeof(struct termios));
|
||||||
tcgetattr(0, term_save);
|
tcgetattr(0, term_save);
|
||||||
}
|
}
|
||||||
return (term_save);
|
return (term_save);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/16 17:06:30 by gwojda #+# #+# */
|
/* Created: 2016/12/16 17:06:30 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/16 16:37:39 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 18:10:51 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ char *ft_strndup(char const *s, int n)
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (!(str = (char *)malloc(sizeof(char) * (n + 1))))
|
if (!(str = (char *)ft_malloc(sizeof(char) * (n + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/07 11:00:28 by gwojda #+# #+# */
|
/* Created: 2017/01/07 11:00:28 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/07 17:32:44 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 18:10:50 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ char *ft_strdupi_w(char const *s)
|
||||||
i = 0;
|
i = 0;
|
||||||
while (s[i] && s[i] != ' ' && s[i] != '\t')
|
while (s[i] && s[i] != ' ' && s[i] != '\t')
|
||||||
i++;
|
i++;
|
||||||
str = (char *)malloc(sizeof(char) * (i + 1));
|
str = (char *)ft_malloc(sizeof(char) * (i + 1));
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
str[i--] = '\0';
|
str[i--] = '\0';
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/14 10:56:08 by gwojda #+# #+# */
|
/* Created: 2017/03/14 10:56:08 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/18 12:08:50 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 18:11:12 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/10 11:36:39 by jhalford #+# #+# */
|
/* Created: 2017/01/10 11:36:39 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 14:45:01 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 18:10:49 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,6 +17,6 @@ t_data *data_singleton(void)
|
||||||
static t_data *data = NULL;
|
static t_data *data = NULL;
|
||||||
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
data = malloc(sizeof(t_data));
|
data = ft_malloc(sizeof(t_data));
|
||||||
return (data);
|
return (data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue