IDEFIX: 'OUAFA FEJISGNNOE GSEJG SE GSKNLGSNKENE PAS PAR LES FESSES'

This commit is contained in:
Etienne Rey-bethbeder
2023-02-28 13:19:52 +01:00
parent ed546f5a8d
commit 00e570d92e
2 changed files with 12 additions and 5 deletions

View File

@ -6,21 +6,28 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/20 14:27:36 by erey-bet #+# #+# */
/* Updated: 2023/02/21 14:41:58 by erey-bet ### ########.fr */
/* Updated: 2023/02/28 13:13:23 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */
#include "../minishell.h"
int move_folder(char *path, int fd)
int move_folder(char **args, int fd)
{
char *join;
char *path;
if (args[1] != NULL)
{
write(2, "cd: too many argument", 22);
return (1);
}
path = args[0];
if (path[0] == '/' || ft_strncmp(path, "..", ft_strlen(path)) == 0)
{
if (chdir(path) == 0)
return (0);
ft_printf("chdir error");
write(2, "chdir error", 11);
return (1);
}
else
@ -33,7 +40,7 @@ int move_folder(char *path, int fd)
return (0);
}
free(join);
ft_printf("chdir error");
write(2, "chdir error", 11);
return (1);
}
}