summaryrefslogtreecommitdiffstats
path: root/src/ft_s_init.c
blob: c4b2667830404eab31d83fc16f3a37fbecb843e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_s_init.c                                        :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:19:27 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:19:29 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <libft.h>
#include "ft_d_define.h"
#include "ft_s_init.h"

t_msh
	*ft_init_msh(char *envp[])
{
	t_msh	*msh;

	if (!(msh = (t_msh*)malloc(sizeof(t_msh))))
	{
		return (NULL);
	}
	if (!(msh->ps_one =
		(char*)malloc((ft_strlen(FT_PS_ONE) + 1) * sizeof(char))))
	{
		return (NULL);
	}
	ft_strlcpy(msh->ps_one, FT_PS_ONE, ft_strlen(FT_PS_ONE) + 1);
	msh->envp = envp;
	msh->ret = 0;
	msh->lcom = NULL;
	return (msh);
}