IDEFIX: 'OUAFA FEJISGNNOE GSEJG SE GSKNLGSNKENE PAS PAR LES FESSES'
This commit is contained in:
parent
ed546f5a8d
commit
00e570d92e
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
UTILS_SRC = utils/ft_is_in_quote.c utils/ft_strncpy.c utils/ft_strreplace.c utils/ft_strnchr.c utils/ft_split_quoted.c utils/ft_strshift.c utils/ft_quote_remover.c utils/ft_str_is_empty.c utils/ft_atoi_check.c
|
UTILS_SRC = utils/ft_is_in_quote.c utils/ft_strncpy.c utils/ft_strreplace.c utils/ft_strnchr.c utils/ft_split_quoted.c utils/ft_strshift.c utils/ft_quote_remover.c utils/ft_str_is_empty.c utils/ft_atoi_check.c
|
||||||
SRCS = ${UTILS_SRC} main.c file.c infile.c outfile.c heredoc.c syntatics.c cmd.c cmds.c env.c env2.c env3.c execution.c spacer.c env_fill.c builtins/echo.c builtins/pwd.c builtins/export.c builtins/env.c builtins/cd.c builtins/exit.c
|
SRCS = ${UTILS_SRC} main.c file.c infile.c outfile.c heredoc.c syntatics.c cmd.c cmds.c env.c env2.c env3.c execution.c spacer.c env_fill.c builtins/echo.c builtins/pwd.c builtins/export.c builtins/env.c builtins/cd.c builtins/exit.c builtins/unset.c
|
||||||
|
|
||||||
OBJS = ${SRCS:.c=.o}
|
OBJS = ${SRCS:.c=.o}
|
||||||
|
|
||||||
|
@ -6,21 +6,28 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/20 14:27:36 by erey-bet #+# #+# */
|
/* 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"
|
#include "../minishell.h"
|
||||||
|
|
||||||
int move_folder(char *path, int fd)
|
int move_folder(char **args, int fd)
|
||||||
{
|
{
|
||||||
char *join;
|
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 (path[0] == '/' || ft_strncmp(path, "..", ft_strlen(path)) == 0)
|
||||||
{
|
{
|
||||||
if (chdir(path) == 0)
|
if (chdir(path) == 0)
|
||||||
return (0);
|
return (0);
|
||||||
ft_printf("chdir error");
|
write(2, "chdir error", 11);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -33,7 +40,7 @@ int move_folder(char *path, int fd)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
free(join);
|
free(join);
|
||||||
ft_printf("chdir error");
|
write(2, "chdir error", 11);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user