| 123456789101112131415161718192021222324252627 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_getenv.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@student.42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/03/03 02:48:21 by bchanot #+# #+# */
- /* Updated: 2018/10/29 12:14:56 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include "libft.h"
- char *ft_getenv(char **env, const char *const src)
- {
- if (!env || !ft_tablen(env))
- return (NULL);
- while (*env)
- {
- if (!ft_strncmp(*env, src, ft_strlen(src)) &&
- *(*env + ft_strlen(src)) == '=')
- return ((char *)*env + (ft_strlen(src) + 1));
- env++;
- }
- return (NULL);
- }
|