Skip to content

Commit

Permalink
Fix export and env still using printf
Browse files Browse the repository at this point in the history
  • Loading branch information
Ofacy committed Apr 10, 2024
1 parent bbdd27d commit 8192c05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions srcs/builtins/env.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
/* By: bwisniew <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/14 13:57:41 by bwisniew #+# #+# */
/* Updated: 2024/03/19 17:32:45 by bwisniew ### ########.fr */
/* Updated: 2024/04/10 19:46:23 by lcottet ### ########.fr */
/* */
/* ************************************************************************** */

#include "minishell.h"
#include <stdio.h>
#include "ft_printf.h"

void print_env(t_env *env)
{
if (env->value)
printf("%s=%s\n", env->key, env->value);
ft_printf("%s=%s\n", env->key, env->value);
}

int env(t_mshell *sh, t_execute *exec)
Expand Down
12 changes: 6 additions & 6 deletions srcs/builtins/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
/* By: bwisniew <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/14 13:57:39 by bwisniew #+# #+# */
/* Updated: 2024/03/19 18:35:56 by bwisniew ### ########.fr */
/* Updated: 2024/04/10 19:45:58 by lcottet ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "ft_printf.h"
#include "minishell.h"
#include <stdlib.h>
#include <stdio.h>

t_env *export_sort(t_mshell *sh)
{
Expand All @@ -38,10 +38,10 @@ int export_print(t_mshell *sh)
return (1);
while (i < sh->env.len)
{
if (env[i].value && printf("%s=%s\n", env[i].key, env[i].value) == -1)
return (0);
else if (!env[i].value && printf("%s\n", env[i].key) == -1)
return (0);
if (env[i].value && ft_printf("%s=%s\n", env[i].key, env[i].value) == -1)
return (1);
else if (!env[i].value && ft_printf("%s\n", env[i].key) == -1)
return (1);
i++;
}
free(env);
Expand Down

0 comments on commit 8192c05

Please sign in to comment.