Archived
1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
pipex/src/utils/getpath.c

31 lines
1.1 KiB
C
Raw Normal View History

2024-03-22 21:23:17 +01:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
2024-04-07 11:03:38 +02:00
/* getpath.c :+: :+: :+: */
2024-03-22 21:23:17 +01:00
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
2024-04-07 11:03:38 +02:00
/* Created: 2024/04/04 15:32:56 by adjoly #+# #+# */
2024-04-08 12:54:24 +02:00
/* Updated: 2024/04/07 16:20:05 by adjoly ### ########.fr */
2024-03-22 21:23:17 +01:00
/* */
/* ************************************************************************** */
2024-04-07 11:03:38 +02:00
#include "pipex.h"
2024-03-22 21:23:17 +01:00
2024-04-07 11:03:38 +02:00
void getpath(t_pipex *pipex)
2024-03-28 23:05:43 +01:00
{
2024-04-07 11:03:38 +02:00
char **env;
2024-03-28 23:05:43 +01:00
2024-04-07 11:03:38 +02:00
env = pipex->env;
while (*env)
2024-03-28 23:05:43 +01:00
{
2024-04-07 11:03:38 +02:00
if (!ft_strncmp(*env, "PATH=", 5))
{
2024-04-08 12:54:24 +02:00
pipex->path = ft_split((*env) + 5, ':');
2024-04-07 11:03:38 +02:00
return ;
}
env++;
2024-03-28 23:05:43 +01:00
}
2024-04-07 11:03:38 +02:00
pipex->path = NULL;
2024-03-28 23:05:43 +01:00
}