28 lines
1.2 KiB
C
28 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* retrieve_path.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2021/10/08 09:22:12 by lperrey #+# #+# */
|
|
/* Updated: 2021/12/08 06:27:23 by lperrey ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "minishell.h"
|
|
|
|
char **retrieve_path(void)
|
|
{
|
|
char *path;
|
|
char **path_split;
|
|
|
|
path = getenv("PATH");
|
|
if (!path)
|
|
return (ft_retp_print(NULL, "minishell: Warning, $PATH not set\n", 2));
|
|
path_split = ft_split(path, ':');
|
|
if (!path_split)
|
|
return (ft_retp_perror(NULL, "retrieve_path()"));
|
|
return (path_split);
|
|
}
|