Compare commits
2 Commits
e2c43eb973
...
ec752adbfa
Author | SHA1 | Date | |
---|---|---|---|
|
ec752adbfa | ||
|
dbb39712ea |
@ -6,17 +6,17 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/14 14:27:08 by cchauvet #+# #+# */
|
/* Created: 2023/02/14 14:27:08 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/03/09 19:58:25 by erey-bet ### ########.fr */
|
/* Updated: 2023/03/13 13:09:13 by erey-bet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "./builtins_private.h"
|
#include "./builtins_private.h"
|
||||||
|
|
||||||
static int error(char *str, int fd)
|
static int error(char *str)
|
||||||
{
|
{
|
||||||
write(fd, "bash: export: `", 15);
|
write(2, "bash: export: `", 15);
|
||||||
write(fd, str, ft_strlen(str));
|
write(2, str, ft_strlen(str));
|
||||||
write(fd, "': not a valid identifier\n", 26);
|
write(2, "': not a valid identifier\n", 26);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ int add_export(t_list **env, char *args, int fd)
|
|||||||
if (ft_strchr(args, '=') != NULL)
|
if (ft_strchr(args, '=') != NULL)
|
||||||
{
|
{
|
||||||
if (set_key_value_export(env, args, &key, &value))
|
if (set_key_value_export(env, args, &key, &value))
|
||||||
return (error(args, fd));
|
return (error(args));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -80,10 +80,10 @@ int add_export(t_list **env, char *args, int fd)
|
|||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
value = ft_strdup(value);
|
value = ft_strdup(value);
|
||||||
if (possible_key(key) == 2)
|
if (possible_key(key) == 2)
|
||||||
return (error(key, fd));
|
return (error(key));
|
||||||
}
|
}
|
||||||
if (!possible_key(key))
|
if (!possible_key(key))
|
||||||
return (error(args, fd));
|
return (error(args));
|
||||||
create_value_by_key(key, value, env);
|
create_value_by_key(key, value, env);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user