summaryrefslogtreecommitdiffstats
path: root/src/s_init_next.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/s_init_next.c')
-rw-r--r--src/s_init_next.c32
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 ;
- }
-}