aboutsummaryrefslogtreecommitdiff
path: root/lib/libft
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libft')
-rw-r--r--lib/libft/Makefile3
-rw-r--r--lib/libft/ft_strcat.c29
-rw-r--r--lib/libft/ft_strcmp.c23
-rw-r--r--lib/libft/ft_strcpy.c25
-rw-r--r--lib/libft/libft.h5
5 files changed, 84 insertions, 1 deletions
diff --git a/lib/libft/Makefile b/lib/libft/Makefile
index 6f2950c..2150e99 100644
--- a/lib/libft/Makefile
+++ b/lib/libft/Makefile
@@ -26,6 +26,8 @@ SRC = ft_atoi.c \
ft_strdup.c \
ft_striteri.c \
ft_strjoin.c \
+ ft_strcat.c \
+ ft_strcpy.c \
ft_strlcat.c \
ft_strlcpy.c \
ft_strlen.c \
@@ -45,6 +47,7 @@ SRC = ft_atoi.c \
get_next_line.c \
get_next_line_utils.c \
ft_atol.c \
+ ft_strcmp.c \
ft_lstnew_bonus.c \
ft_lstadd_front_bonus.c \
ft_lstsize_bonus.c \
diff --git a/lib/libft/ft_strcat.c b/lib/libft/ft_strcat.c
new file mode 100644
index 0000000..b21235b
--- /dev/null
+++ b/lib/libft/ft_strcat.c
@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strcat.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2025/01/09 13:06:44 by chuhlig #+# #+# */
+/* Updated: 2025/01/14 14:09:49 by chuhlig ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+char *ft_strcat(char *dest, char *src)
+{
+ int i;
+ int j;
+
+ j = 0;
+ i = 0;
+ while (dest[i])
+ i++;
+ while (src[j])
+ {
+ dest[i + j] = src[j];
+ j++;
+ }
+ dest[i + j] = '\0';
+ return (dest);
+}
diff --git a/lib/libft/ft_strcmp.c b/lib/libft/ft_strcmp.c
new file mode 100644
index 0000000..a319c63
--- /dev/null
+++ b/lib/libft/ft_strcmp.c
@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strcmp.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2024/12/18 19:03:14 by chuhlig #+# #+# */
+/* Updated: 2025/01/14 14:09:59 by chuhlig ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int ft_strcmp(char *s1, char *s2)
+{
+ int i;
+
+ i = 0;
+ while (s1[i] && s1[i] == s2[i])
+ i++;
+ return (s1[i] - s2[i]);
+}
diff --git a/lib/libft/ft_strcpy.c b/lib/libft/ft_strcpy.c
new file mode 100644
index 0000000..94a07f7
--- /dev/null
+++ b/lib/libft/ft_strcpy.c
@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_strcpy.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2025/01/09 14:38:30 by chuhlig #+# #+# */
+/* Updated: 2025/01/14 14:10:06 by chuhlig ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+char *ft_strcpy(char *dest, char *src)
+{
+ int i;
+
+ i = 0;
+ while (src[i] != '\0')
+ {
+ dest[i] = src[i];
+ i++;
+ }
+ dest[i] = '\0';
+ return (dest);
+}
diff --git a/lib/libft/libft.h b/lib/libft/libft.h
index abb739d..6b4c824 100644
--- a/lib/libft/libft.h
+++ b/lib/libft/libft.h
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/10 16:37:54 by dkaiser #+# #+# */
-/* Updated: 2024/08/11 14:01:57 by chuhlig ### ########.fr */
+/* Updated: 2025/01/09 14:39:28 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -26,6 +26,7 @@ int ft_isalnum(int c);
int ft_isprint(int c);
int ft_isspace(char c);
int ft_isascii(int c);
+int ft_strcmp(char *s1, char *s2);
int ft_strlen(const char *str);
void *ft_memset(void *b, int c, size_t len);
void ft_bzero(void *s, size_t n);
@@ -59,6 +60,8 @@ void ft_putstr_fd(char *s, int fd);
void ft_putendl_fd(char *s, int fd);
void ft_putnbr_fd(int n, int fd);
char *ft_strncpy(char *s1, char *s2, int n);
+char *ft_strcat(char *dest, char *src);
+char *ft_strcpy(char *dest, char *src);
typedef struct s_list
{