diff options
Diffstat (limited to 'src/env.c')
| -rw-r--r-- | src/env.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:21:24 by cacharle #+# #+# */ -/* Updated: 2020/05/08 13:48:40 by charles ### ########.fr */ +/* Updated: 2020/06/09 16:15:47 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -75,8 +75,10 @@ char *env_search_first_match(t_env env, const char *haystack) len = 0; while (ft_isalnum(haystack[len]) || haystack[len] == '_') len++; + if (len == 0) + return ("$"); i = 0; - while (i < env->size) + while (i < env->size - 1) { if (ft_strncmp((char*)env->data[i], haystack, len) == 0) return (ft_strchr((char*)env->data[i], '=') + 1); |
