BIENTOT FINI POTO PAVAAAARRDDDD
This commit is contained in:
parent
876c75bb92
commit
f956986789
BIN
builtins/cd.o
Normal file
BIN
builtins/cd.o
Normal file
Binary file not shown.
BIN
builtins/echo.o
Normal file
BIN
builtins/echo.o
Normal file
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/14 14:56:02 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/23 16:50:01 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/03/09 15:04:47 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -19,10 +19,13 @@ int print_env(t_list **env, int fd)
|
||||
current = *env;
|
||||
while (current->next != NULL)
|
||||
{
|
||||
ft_putstr_fd(((t_env *)(current->content))->key, fd);
|
||||
ft_putstr_fd("=", fd);
|
||||
ft_putstr_fd(((t_env *)(current->content))->value, fd);
|
||||
write(fd, "\n", 1);
|
||||
if (((t_env *)(current->content))->original)
|
||||
{
|
||||
ft_putstr_fd(((t_env *)(current->content))->key, fd);
|
||||
ft_putstr_fd("=", fd);
|
||||
ft_putstr_fd(((t_env *)(current->content))->value, fd);
|
||||
write(fd, "\n", 1);
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
return (0);
|
||||
|
BIN
builtins/env.o
Normal file
BIN
builtins/env.o
Normal file
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/24 10:17:59 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/02/28 14:55:39 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/02/28 15:06:50 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -34,7 +34,7 @@ int ft_exit(char **args)
|
||||
if (err == 1)
|
||||
return (error(err, "numeric argument required", args[0]));
|
||||
if (args[1] != NULL)
|
||||
return (error(-1, "too many arguments", NULL));
|
||||
return (error(1, "too many arguments", NULL));
|
||||
if (err > 0)
|
||||
return(error(err, "numeric argument required", args[0]));
|
||||
return ((ft_atoi(args[0]) % 256 + 256) % 256);
|
||||
|
BIN
builtins/exit.o
Normal file
BIN
builtins/exit.o
Normal file
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/14 14:27:08 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/28 14:37:38 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/03/09 14:58:11 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -29,38 +29,50 @@ void print_export(t_list **env, int fd)
|
||||
{
|
||||
write(fd, "declare -x ", 11);
|
||||
ft_putstr_fd(((t_env *)(current->content))->key, fd);
|
||||
ft_putstr_fd("=", fd);
|
||||
write(fd, "\"", 1);
|
||||
ft_putstr_fd(((t_env *)(current->content))->value, fd);
|
||||
write(fd, "\"\n", 2);
|
||||
if (((t_env *)(current->content))->value != NULL)
|
||||
{
|
||||
ft_putstr_fd("=", fd);
|
||||
write(fd, "\"", 1);
|
||||
ft_putstr_fd(((t_env *)(current->content))->value, fd);
|
||||
write(fd, "\"\n", 2);
|
||||
}
|
||||
else
|
||||
write(fd, "\n", 2);
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
int add_export(t_list **env, char *args, int fd, int *err)
|
||||
int add_export(t_list **env, char *args, int fd)
|
||||
{
|
||||
char *key;
|
||||
char *value;
|
||||
|
||||
key = args;
|
||||
value = "";
|
||||
if (ft_strchr(args, '=') != NULL)
|
||||
{
|
||||
key = ft_strndup(args, ft_strnchr(args, '='));
|
||||
if (key == NULL)
|
||||
return (1);
|
||||
if (ft_strlen(key) == 0)
|
||||
return (error(args, fd));
|
||||
if (possible_key(key) == 2)
|
||||
{
|
||||
error(args, fd);
|
||||
return (1);
|
||||
key[ft_strlen(key) - 1] = '\0';
|
||||
value = ft_strjoin(get_value_by_key(key, env), ft_strchr(args, '=') + 1);
|
||||
}
|
||||
value = ft_strchr(args, '=') + 1;
|
||||
else
|
||||
value = ft_strchr(args, '=') + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = get_value_by_key(key, env);
|
||||
if (ft_strlen(value) == 0)
|
||||
value = NULL;
|
||||
if(possible_key(key) == 2)
|
||||
return (error(key, fd));
|
||||
}
|
||||
if (!possible_key(key))
|
||||
{
|
||||
*err = error(key, fd);
|
||||
return (1);
|
||||
}
|
||||
return (error(key, fd));
|
||||
create_value_by_key_dup(key, value, env);
|
||||
return (0);
|
||||
}
|
||||
@ -77,7 +89,7 @@ int export(t_list **env, char **args, int fd)
|
||||
{
|
||||
i = -1;
|
||||
while (args[++i])
|
||||
if (add_export(env, args[i], fd, &err) == 1)
|
||||
if (add_export(env, args[i], fd) == 1)
|
||||
err = 1;
|
||||
}
|
||||
return (err);
|
||||
|
BIN
builtins/export.o
Normal file
BIN
builtins/export.o
Normal file
Binary file not shown.
BIN
builtins/pwd.o
Normal file
BIN
builtins/pwd.o
Normal file
Binary file not shown.
BIN
builtins/unset.o
Normal file
BIN
builtins/unset.o
Normal file
Binary file not shown.
4
env.c
4
env.c
@ -6,7 +6,7 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/02 14:39:56 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/02/23 13:34:41 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/03/09 15:06:44 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -80,6 +80,7 @@ int create_value_by_key(char *key, char *value, t_list **head)
|
||||
return (1);
|
||||
content->key = key;
|
||||
content->value = value;
|
||||
content->original = 0;
|
||||
add_sort(head, content);
|
||||
return (0);
|
||||
}
|
||||
@ -104,6 +105,7 @@ t_list **init_env(char **env)
|
||||
return (NULL);
|
||||
var->key = get_key(env[i]);
|
||||
var->value = get_value(env[i]);
|
||||
var->original = 1;
|
||||
add_sort(head, var);
|
||||
}
|
||||
return (head);
|
||||
|
25
env3.c
25
env3.c
@ -6,7 +6,7 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/17 17:25:09 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/02/28 12:46:33 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/03/09 14:57:26 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -44,19 +44,22 @@ int create_value_by_key_dup(char *key, char *value, t_list **env)
|
||||
char *key_dup;
|
||||
char *value_dup;
|
||||
|
||||
if (set_value_by_key(key, value, env) == 0)
|
||||
return (0);
|
||||
key_dup = ft_strdup(key);
|
||||
if (key_dup == NULL)
|
||||
{
|
||||
ft_eprintf("minishell: malloc failed\n");
|
||||
return (1);
|
||||
}
|
||||
value_dup = ft_strdup(value);
|
||||
if (value_dup == NULL)
|
||||
if (value != NULL)
|
||||
{
|
||||
free(key);
|
||||
ft_eprintf("minishell: malloc failed\n");
|
||||
return (1);
|
||||
value_dup = ft_strdup(value);
|
||||
if (value_dup == NULL)
|
||||
{
|
||||
free(key);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
value_dup = value;
|
||||
if (create_value_by_key(key_dup, value_dup, env))
|
||||
return (1);
|
||||
return (0);
|
||||
@ -91,8 +94,10 @@ int possible_key(char *key)
|
||||
i = -1;
|
||||
if (ft_isdigit(key[i + 1]))
|
||||
return (0);
|
||||
while (key[++i])
|
||||
while (key[++i + 1])
|
||||
if (!ft_isalnum(key[i]) && key[i] != '_')
|
||||
return (0);
|
||||
if (key[i] == '+')
|
||||
return (2);
|
||||
return (1);
|
||||
}
|
||||
|
BIN
env_fill.o
Normal file
BIN
env_fill.o
Normal file
Binary file not shown.
BIN
execution.o
Normal file
BIN
execution.o
Normal file
Binary file not shown.
BIN
libftx/extra/extra.a
Normal file
BIN
libftx/extra/extra.a
Normal file
Binary file not shown.
BIN
libftx/extra/ft_contain_only.o
Normal file
BIN
libftx/extra/ft_contain_only.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_freer.o
Normal file
BIN
libftx/extra/ft_freer.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_is_in.o
Normal file
BIN
libftx/extra/ft_is_in.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_random_generator.o
Normal file
BIN
libftx/extra/ft_random_generator.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strchri.o
Normal file
BIN
libftx/extra/ft_strchri.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strcmp.o
Normal file
BIN
libftx/extra/ft_strcmp.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strfjoin.o
Normal file
BIN
libftx/extra/ft_strfjoin.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strgen.o
Normal file
BIN
libftx/extra/ft_strgen.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strmerger.o
Normal file
BIN
libftx/extra/ft_strmerger.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strndup.o
Normal file
BIN
libftx/extra/ft_strndup.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_swap.o
Normal file
BIN
libftx/extra/ft_swap.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_tabrealloc.o
Normal file
BIN
libftx/extra/ft_tabrealloc.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_ultoa_base.o
Normal file
BIN
libftx/extra/ft_ultoa_base.o
Normal file
Binary file not shown.
BIN
libftx/gnl/get_next_line.a
Normal file
BIN
libftx/gnl/get_next_line.a
Normal file
Binary file not shown.
BIN
libftx/gnl/get_next_line.o
Normal file
BIN
libftx/gnl/get_next_line.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_atoi.o
Normal file
BIN
libftx/libft/ft_atoi.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_bzero.o
Normal file
BIN
libftx/libft/ft_bzero.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_calloc.o
Normal file
BIN
libftx/libft/ft_calloc.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isalnum.o
Normal file
BIN
libftx/libft/ft_isalnum.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isalpha.o
Normal file
BIN
libftx/libft/ft_isalpha.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isascii.o
Normal file
BIN
libftx/libft/ft_isascii.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isdigit.o
Normal file
BIN
libftx/libft/ft_isdigit.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isprint.o
Normal file
BIN
libftx/libft/ft_isprint.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_itoa.o
Normal file
BIN
libftx/libft/ft_itoa.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstadd_back.o
Normal file
BIN
libftx/libft/ft_lstadd_back.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstadd_front.o
Normal file
BIN
libftx/libft/ft_lstadd_front.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstclear.o
Normal file
BIN
libftx/libft/ft_lstclear.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstdelone.o
Normal file
BIN
libftx/libft/ft_lstdelone.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstiter.o
Normal file
BIN
libftx/libft/ft_lstiter.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstlast.o
Normal file
BIN
libftx/libft/ft_lstlast.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstmap.o
Normal file
BIN
libftx/libft/ft_lstmap.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstnew.o
Normal file
BIN
libftx/libft/ft_lstnew.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstsize.o
Normal file
BIN
libftx/libft/ft_lstsize.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memchr.o
Normal file
BIN
libftx/libft/ft_memchr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memcmp.o
Normal file
BIN
libftx/libft/ft_memcmp.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memcpy.o
Normal file
BIN
libftx/libft/ft_memcpy.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memmove.o
Normal file
BIN
libftx/libft/ft_memmove.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memset.o
Normal file
BIN
libftx/libft/ft_memset.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_putchar_fd.o
Normal file
BIN
libftx/libft/ft_putchar_fd.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_putendl_fd.o
Normal file
BIN
libftx/libft/ft_putendl_fd.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_putnbr_fd.o
Normal file
BIN
libftx/libft/ft_putnbr_fd.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_putstr_fd.o
Normal file
BIN
libftx/libft/ft_putstr_fd.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_split.o
Normal file
BIN
libftx/libft/ft_split.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strchr.o
Normal file
BIN
libftx/libft/ft_strchr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strdup.o
Normal file
BIN
libftx/libft/ft_strdup.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_striteri.o
Normal file
BIN
libftx/libft/ft_striteri.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strjoin.o
Normal file
BIN
libftx/libft/ft_strjoin.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strlcat.o
Normal file
BIN
libftx/libft/ft_strlcat.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strlcpy.o
Normal file
BIN
libftx/libft/ft_strlcpy.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strlen.o
Normal file
BIN
libftx/libft/ft_strlen.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strmapi.o
Normal file
BIN
libftx/libft/ft_strmapi.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strncmp.o
Normal file
BIN
libftx/libft/ft_strncmp.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strnstr.o
Normal file
BIN
libftx/libft/ft_strnstr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strrchr.o
Normal file
BIN
libftx/libft/ft_strrchr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strtrim.o
Normal file
BIN
libftx/libft/ft_strtrim.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_substr.o
Normal file
BIN
libftx/libft/ft_substr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_tolower.o
Normal file
BIN
libftx/libft/ft_tolower.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_toupper.o
Normal file
BIN
libftx/libft/ft_toupper.o
Normal file
Binary file not shown.
BIN
libftx/libft/libft.a
Normal file
BIN
libftx/libft/libft.a
Normal file
Binary file not shown.
BIN
libftx/libftx.a
Normal file
BIN
libftx/libftx.a
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintX.o
Normal file
BIN
libftx/printf/ft_dprintX.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintarg.o
Normal file
BIN
libftx/printf/ft_dprintarg.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintflag.o
Normal file
BIN
libftx/printf/ft_dprintflag.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintl_base.o
Normal file
BIN
libftx/printf/ft_dprintl_base.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintptr.o
Normal file
BIN
libftx/printf/ft_dprintptr.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintstrtab.o
Normal file
BIN
libftx/printf/ft_dprintstrtab.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintul.o
Normal file
BIN
libftx/printf/ft_dprintul.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintul_base.o
Normal file
BIN
libftx/printf/ft_dprintul_base.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintx.o
Normal file
BIN
libftx/printf/ft_dprintx.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_eprintf.o
Normal file
BIN
libftx/printf/ft_eprintf.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_isarg.o
Normal file
BIN
libftx/printf/ft_isarg.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_isdigit.o
Normal file
BIN
libftx/printf/ft_isdigit.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_printf.a
Normal file
BIN
libftx/printf/ft_printf.a
Normal file
Binary file not shown.
BIN
libftx/printf/ft_printf.o
Normal file
BIN
libftx/printf/ft_printf.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_putchar_fd.o
Normal file
BIN
libftx/printf/ft_putchar_fd.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_putstr_fd.o
Normal file
BIN
libftx/printf/ft_putstr_fd.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_skipflag.o
Normal file
BIN
libftx/printf/ft_skipflag.o
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user