42_minishell/src/path.c
2024-04-24 13:29:49 +02:00

28 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* path.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/16 12:07:26 by jschaft #+# #+# */
/* Updated: 2024/04/24 13:26:41 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
#include "include.h"
const char **get_path(const char **envp)
{
int i;
char **re;
char *path;
i = 0;
while (ft_strncmp(envp[i], "PATH=", 5) != 0)
i++;
path = ft_substr(envp[i], 5, ft_strlen(envp[i]) - 5);
re = ft_split(path, ':');
free(path);
return ((const char **)re);
}