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