diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-12-18 21:04:29 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-12-18 21:04:29 +0100 |
commit | f543cdc19dae32a70e7efae35f499008bacb2f6b (patch) | |
tree | 59ddbdfe412ba4d0f69d9b798cd9e70836d95919 /src/s_init_next.c | |
parent | Removed TODO.org (diff) | |
parent | qweqweqweqwe (diff) | |
download | 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.tar.gz 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.tar.bz2 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.tar.xz 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.tar.zst 42-minishell-f543cdc19dae32a70e7efae35f499008bacb2f6b.zip |
Merge branch 'master' of jozanleclerc.xyz:42-minishell
Diffstat (limited to 'src/s_init_next.c')
-rw-r--r-- | src/s_init_next.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/s_init_next.c b/src/s_init_next.c index 6ee17d4..8ee3b7e 100644 --- a/src/s_init_next.c +++ b/src/s_init_next.c @@ -113,35 +113,3 @@ char **s_dupenv(char *const envp[]) nenvp[i] = NULL; return (nenvp); } - -void s_set_cwd(char cwd[], t_msh *msh) -{ - char fmt[PATH_MAX]; - DIR *dir; - - u_get_var_value(cwd, "$PWD", PATH_MAX, msh); - if (cwd[0] == C_NUL) - { - if (getcwd(cwd, PATH_MAX) != NULL) - { - ft_sprintf(fmt, "%s=%s", "PWD", cwd); - b_export_with_equals(fmt, msh); - } - else - ft_dprintf(STDERR_FILENO, "minishell: %s\n", strerror(errno)); - return ; - } - if ((dir = opendir(cwd)) != NULL) - closedir(dir); - else if (errno == ENOENT) - { - if (getcwd(cwd, PATH_MAX) != NULL) - { - ft_sprintf(fmt, "%s=%s", "PWD", cwd); - b_export_with_equals(fmt, msh); - } - else - ft_dprintf(STDERR_FILENO, "minishell: %s\n", strerror(errno)); - return ; - } -} |