Compare commits

..

No commits in common. "13e455cbf416436a889715c7d87301bebebc1228" and "1c43d89fa19fad14a244a490d2e3da86f4e0a543" have entirely different histories.

4 changed files with 12 additions and 13 deletions

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/20 14:27:36 by erey-bet #+# #+# */
/* Updated: 2023/03/21 13:16:24 by erey-bet ### ########.fr */
/* Updated: 2023/03/13 15:11:07 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */
@ -32,12 +32,17 @@ int move_folder(char **args, int fd)
{
char *path;
if (args[1] != NULL || args[0] == NULL)
if (args[1] != NULL)
{
write(2, "cd: Wrong number's argument\n", 28);
write(2, "cd: too many argument\n", 22);
return (1);
}
path = args[0];
if (!path)
{
write(2, "No such file or directory\n", 26);
return (1);
}
if (path[0] == '/' || ft_strncmp(path, "..", ft_strlen(path)) == 0)
{
if (chdir(path) == 0)

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/14 14:27:08 by cchauvet #+# #+# */
/* Updated: 2023/03/30 13:04:53 by erey-bet ### ########.fr */
/* Updated: 2023/03/13 13:23:56 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */

6
env/env1.c vendored
View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* env1.c :+: :+: :+: */
/* env.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/02 14:39:56 by erey-bet #+# #+# */
/* Updated: 2023/03/30 13:07:15 by erey-bet ### ########.fr */
/* Updated: 2023/03/09 19:01:05 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */
@ -61,9 +61,7 @@ int set_value_by_key(char *key, char *value, t_list **head)
if (ft_strcmp(((t_env *)current->content)->key, key) == 0)
{
free(((t_env *)current->content)->value);
free(((t_env *)current->content)->key);
((t_env *)current->content)->value = value;
((t_env *)current->content)->key = key;
return (0);
}
current = current->next;

6
env/env3.c vendored
View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 17:25:09 by erey-bet #+# #+# */
/* Updated: 2023/03/30 12:51:54 by erey-bet ### ########.fr */
/* Updated: 2023/03/09 19:58:55 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */
@ -74,14 +74,10 @@ int delete_by_key(char *key, t_list **head)
{
if (ft_strcmp(((t_env *)current->content)->key, key) == 0)
{
free(((t_env *)current->content)->key);
free(((t_env *)current->content)->value);
free(current->content);
if (last->next != NULL)
last->next = current->next;
else
*head = current->next;
free(current);
return (0);
}
last = current;