-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
done, norme à faire et leaks à détect
- Loading branch information
Baptiste Renaudon
authored and
Baptiste Renaudon
committed
Jan 5, 2023
1 parent
331a637
commit 25a5959
Showing
7 changed files
with
75 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ SRCS = add_cmd.c \ | |
cd.c \ | ||
dollar.c \ | ||
echo.c \ | ||
env.c \ | ||
errors.c \ | ||
exit.c \ | ||
export.c \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* env.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: brenaudo <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/01/05 10:48:10 by brenaudo #+# #+# */ | ||
/* Updated: 2023/01/05 10:48:12 by brenaudo ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "minishell.h" | ||
|
||
static void env_no_arg(int fd_out) | ||
{ | ||
int i; | ||
char **envp; | ||
|
||
envp = envp_list_to_tab(); | ||
i = 0; | ||
while (envp[i]) | ||
{ | ||
if (ft_strncmp(envp[i], "_=", 2)) | ||
{ | ||
ft_putstr_fd(envp[i], fd_out); | ||
ft_putchar_fd('\n', fd_out); | ||
} | ||
i++; | ||
} | ||
free_tab(envp); | ||
} | ||
|
||
void env(char *cmd, int fd_out) | ||
{ | ||
(void)cmd; | ||
env_no_arg(fd_out); | ||
close(fd_out); | ||
clean_exit(NULL); | ||
exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters