Skip to content

Commit

Permalink
fix: resolve file conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatmanur Cetintas committed Mar 3, 2024
2 parents 179dd03 + 47484dd commit b447ad4
Show file tree
Hide file tree
Showing 98 changed files with 2,842 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: download the repository
run: git submodule update --init --recursive
- name: make
run: make
run: make all FLAGS=""
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ $(NAME): $(LIBFT_PATH) $(MINISHELL_OBJECTS)

clean:
rm -f $(MINISHELL_OBJECTS)
make -f libft/Makefile clean

fclean: clean
rm -f $(NAME) $(TEST_PATH)/tests
rm -f $(NAME) $(TEST_PATH)/tests $(LIBFT_PATH)

re: fclean all

Expand Down
14 changes: 13 additions & 1 deletion builtin/cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
/* ::: :::::::: */
/* cd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: facetint <facetint@student.42.fr> +#+ +:+ +#+ */
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
<<<<<<< HEAD:builtin/cd.c
/* Created: 2024/03/03 11:48:16 by facetint #+# #+# */
/* Updated: 2024/03/03 11:48:37 by facetint ### ########.fr */
=======
/* Created: 2023/06/24 20:38:03 by hcoskun42 #+# #+# */
/* Updated: 2023/07/08 14:34:36 by hcoskun ### ########.fr */
>>>>>>> main:libft/ft_putchar_fd.c
/* */
/* ************************************************************************** */

#include "../includes/minishell.h"
#include "../libft/libft.h"
#include <stdio.h>

<<<<<<< HEAD:builtin/cd.c
=======
void ft_putchar_fd(char c, int fd)
{
write(fd, &c, 1);
}
>>>>>>> main:libft/ft_putchar_fd.c
26 changes: 24 additions & 2 deletions builtin/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
/* ::: :::::::: */
/* export.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: facetint <facetint@student.42.fr> +#+ +:+ +#+ */
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
<<<<<<< HEAD:builtin/export.c
/* Created: 2024/03/02 14:15:14 by facetint #+# #+# */
/* Updated: 2024/03/03 11:39:15 by facetint ### ########.fr */
=======
/* Created: 2023/07/08 16:18:16 by hcoskun #+# #+# */
/* Updated: 2023/07/11 14:47:49 by hcoskun ### ########.fr */
>>>>>>> main:libft/ft_lstadd_back.c
/* */
/* ************************************************************************** */

Expand All @@ -17,6 +22,7 @@

void builtin_export(t_command *cmd, int fd[2])
{
<<<<<<< HEAD:builtin/export.c
(void)cmd;
t_envList *tmp = get_global_env();
while (tmp)
Expand All @@ -29,4 +35,20 @@ void builtin_export(t_command *cmd, int fd[2])
tmp = tmp->next;
}

}
}
=======
t_list *last_node;

if (!lst)
return ;
if (!*lst)
{
*lst = new;
return ;
}
last_node = ft_lstlast(*lst);
if (!last_node)
return ;
last_node -> next = new;
}
>>>>>>> main:libft/ft_lstadd_back.c
21 changes: 20 additions & 1 deletion builtin/pwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
/* ::: :::::::: */
/* pwd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: facetint <facetint@student.42.fr> +#+ +:+ +#+ */
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
<<<<<<< HEAD:builtin/pwd.c
/* Created: 2024/03/02 13:41:06 by facetint #+# #+# */
/* Updated: 2024/03/03 13:17:22 by facetint ### ########.fr */
/* */
Expand All @@ -13,15 +14,33 @@
#include "../includes/minishell.h"
#include "../libft/libft.h"
#include <stdio.h>
=======
/* Created: 2023/06/24 20:30:45 by hcoskun42 #+# #+# */
/* Updated: 2023/12/31 15:40:54 by hcoskun42 ### ########.tr */
/* */
/* ************************************************************************** */

#include "libft.h"
>>>>>>> main:libft/ft_calloc.c
#include "../memory-allocator/allocator.h"

void builtin_pwd(t_command *cmd)
{
<<<<<<< HEAD:builtin/pwd.c
(void)cmd;
char *path;

path = safe_malloc(sizeof(char) * 4097);
getcwd(path, 4097);
printf("%s\n", path);
safe_free(path);
=======
void *result;

result = safe_malloc(count * size);
if (result == NULL)
return (NULL);
ft_bzero(result, count * size);
return (result);
>>>>>>> main:libft/ft_calloc.c
}
15 changes: 14 additions & 1 deletion builtin/unset.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
/* ::: :::::::: */
/* unset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: facetint <facetint@student.42.fr> +#+ +:+ +#+ */
/* By: hcoskun42 <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
<<<<<<< HEAD:builtin/unset.c
/* Created: 2024/03/03 13:19:04 by facetint #+# #+# */
/* Updated: 2024/03/03 13:19:46 by facetint ### ########.fr */
=======
/* Created: 2023/06/24 21:58:10 by hcoskun42 #+# #+# */
/* Updated: 2023/06/24 21:58:18 by hcoskun42 ### ########.tr */
>>>>>>> main:libft/ft_putendl_fd.c
/* */
/* ************************************************************************** */

Expand All @@ -15,3 +20,11 @@
#include <stdio.h>
#include "../memory-allocator/allocator.h"

<<<<<<< HEAD:builtin/unset.c
=======
void ft_putendl_fd(char *s, int fd)
{
ft_putstr_fd(s, fd);
write(fd, "\n", 1);
}
>>>>>>> main:libft/ft_putendl_fd.c
3 changes: 3 additions & 0 deletions handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ char const *token_type_to_string(t_token_type type)
# define PARSER_DEBUG
void debug(t_token *token, t_command *cmd) {
(void) token,(void) cmd;



#ifdef PARSER_DEBUG
if (!cmd) {
printf("<No Command>");
Expand Down
1 change: 0 additions & 1 deletion libft
Submodule libft deleted from 103809
25 changes: 25 additions & 0 deletions libft/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
NAME = libft.a
CC = gcc
CFLAGS= -Wall -Wextra -Werror
SOURCES = ft_atoi.c ft_bzero.c ft_calloc.c ft_isalnum.c ft_isalpha.c ft_isascii.c ft_isdigit.c ft_isprint.c ft_itoa.c ft_memchr.c ft_memcmp.c ft_memcpy.c ft_memmove.c ft_memset.c ft_putchar_fd.c ft_putendl_fd.c ft_putnbr_fd.c ft_putstr_fd.c ft_split.c ft_strchr.c ft_strdup.c ft_striteri.c ft_strjoin.c ft_strlcat.c ft_strlcpy.c ft_strlen.c ft_strmapi.c ft_strncmp.c ft_strnstr.c ft_strrchr.c ft_strtrim.c ft_substr.c ft_tolower.c ft_toupper.c
OBJECTS = $(SOURCES:.c=.o)

BONUS_SOURCES = ft_lstadd_back.c ft_lstadd_front.c ft_lstclear.c ft_lstdelone.c ft_lstiter.c ft_lstlast.c ft_lstmap.c ft_lstnew.c ft_lstsize.c
BONUS_OBJECTS = $(BONUS_SOURCES:.c=.o)

all: $(OBJECTS)

%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
ar -rcs $(NAME) $@

clean:
rm -f $(OBJECTS) $(BONUS_OBJECTS)

fclean: clean
rm -f $(NAME)

re: fclean all

bonus: $(OBJECTS) $(BONUS_OBJECTS)
ar -rc $(NAME) $(OBJECTS) $(BONUS_OBJECTS)
42 changes: 42 additions & 0 deletions libft/ft_atoi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/24 21:55:40 by hcoskun42 #+# #+# */
/* Updated: 2023/07/08 16:18:52 by hcoskun ### ########.fr */
/* */
/* ************************************************************************** */

int natural_atoi(const char *str)
{
int res;

res = 0;
while (*str >= '0' && *str <= '9')
{
res = res * 10 + *str - '0';
str++;
}
return (res);
}

int ft_atoi(const char *str)
{
int sign;

sign = 1;
while (*str == ' ' || (*str >= 9 && *str <= 13))
str++;
if (!*str)
return (0);
if (*str == '+' || *str == '-')
{
if (*str == '-')
sign *= -1;
str++;
}
return (sign * natural_atoi(str));
}
42 changes: 42 additions & 0 deletions libft/ft_atoi.c.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/24 21:55:40 by hcoskun42 #+# #+# */
/* Updated: 2023/07/08 16:18:52 by hcoskun ### ########.fr */
/* */
/* ************************************************************************** */

int natural_atoi(const char *str)
{
int res;

res = 0;
while (*str >= '0' && *str <= '9')
{
res = res * 10 + *str - '0';
str++;
}
return (res);
}

int ft_atoi(const char *str)
{
int sign;

sign = 1;
while (*str == ' ' || (*str >= 9 && *str <= 13))
str++;
if (!*str)
return (0);
if (*str == '+' || *str == '-')
{
if (*str == '-')
sign *= -1;
str++;
}
return (sign * natural_atoi(str));
}
18 changes: 18 additions & 0 deletions libft/ft_bzero.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hcoskun42 <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/24 20:29:52 by hcoskun42 #+# #+# */
/* Updated: 2023/06/24 20:29:54 by hcoskun42 ### ########.tr */
/* */
/* ************************************************************************** */

#include "libft.h"

void ft_bzero(void *s, size_t n)
{
ft_memset(s, '\0', n);
}
18 changes: 18 additions & 0 deletions libft/ft_bzero.c.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_bzero.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hcoskun42 <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/24 20:29:52 by hcoskun42 #+# #+# */
/* Updated: 2023/06/24 20:29:54 by hcoskun42 ### ########.tr */
/* */
/* ************************************************************************** */

#include "libft.h"

void ft_bzero(void *s, size_t n)
{
ft_memset(s, '\0', n);
}
46 changes: 46 additions & 0 deletions libft/ft_calloc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pwd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hcoskun <hcoskun@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
<<<<<<< HEAD:builtin/pwd.c
/* Created: 2024/03/02 13:41:06 by facetint #+# #+# */
/* Updated: 2024/03/03 13:17:22 by facetint ### ########.fr */
/* */
/* ************************************************************************** */

#include "../includes/minishell.h"
#include "../libft/libft.h"
#include <stdio.h>
=======
/* Created: 2023/06/24 20:30:45 by hcoskun42 #+# #+# */
/* Updated: 2023/12/31 15:40:54 by hcoskun42 ### ########.tr */
/* */
/* ************************************************************************** */

#include "libft.h"
>>>>>>> main:libft/ft_calloc.c
#include "../memory-allocator/allocator.h"

void builtin_pwd(t_command *cmd)
{
<<<<<<< HEAD:builtin/pwd.c
(void)cmd;
char *path;

path = safe_malloc(sizeof(char) * 4097);
getcwd(path, 4097);
printf("%s\n", path);
safe_free(path);
=======
void *result;

result = safe_malloc(count * size);
if (result == NULL)
return (NULL);
ft_bzero(result, count * size);
return (result);
>>>>>>> main:libft/ft_calloc.c
}
Loading

0 comments on commit b447ad4

Please sign in to comment.