40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* env3.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/02/17 17:25:09 by erey-bet #+# #+# */
|
|
/* Updated: 2023/02/17 17:31:31 by erey-bet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "minishell.h"
|
|
|
|
char *get_value(char *str)
|
|
{
|
|
char *s;
|
|
int i;
|
|
int start;
|
|
|
|
s = ft_calloc(ft_strlen(str), sizeof(char));
|
|
start = get_index(str, '=');
|
|
i = start;
|
|
while (str[++i])
|
|
s[i - start - 1] = str[i];
|
|
return (s);
|
|
}
|
|
|
|
char *get_key(char *str)
|
|
{
|
|
char *s;
|
|
int i;
|
|
|
|
s = ft_calloc(ft_strlen(str), sizeof(char));
|
|
i = -1;
|
|
while (str[++i] != '=')
|
|
s[i] = str[i];
|
|
return (s);
|
|
}
|