This commit is contained in:
Camille Chauvet
2023-01-06 19:37:36 +01:00
parent 975e0c2ef5
commit d7256c47a5
103 changed files with 495 additions and 180 deletions

View File

@ -1,4 +1,4 @@
:# **************************************************************************** #
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
@ -6,13 +6,13 @@
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
# Updated: 2023/01/05 19:00:54 by cchauvet ### ########.fr #
# Updated: 2023/01/05 20:32:04 by cchauvet ### ########.fr #
# #
# **************************************************************************** #
CC = clang
SRCS = draw.c main.c map.c shape.c xpm.c
SRCS = ft_strchri.c ft_strcmp.c ft_strfjoin.c ft_strmerger.c ft_strndup.c ft_tabrealloc.c ft_is_in.c
OBJS = $(SRCS:.c=.o)

BIN
libftx/extra/extra.a Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 14:03:10 by cchauvet #+# #+# */
/* Updated: 2023/01/05 18:59:25 by cchauvet ### ########.fr */
/* Updated: 2023/01/05 20:31:50 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,6 +18,9 @@
char *ft_strfjoin(char *s1, char *s2);
char *ft_strmerger(size_t arg_len, ...);
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size);
int ft_is_in(char *str, char c);
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size);
char *ft_strndup(char *src, size_t n);
ssize_t ft_strchri(char *str, char c);
int ft_strcmp(char *s1, char *s2);
#endif

26
libftx/extra/ft_is_in.c Normal file
View File

@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_in.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/05 20:29:53 by cchauvet #+# #+# */
/* Updated: 2023/01/05 20:31:20 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "extra.h"
int ft_is_in(char *str, char c)
{
int i;
i = 0;
while (str[i] != '\0')
{
if (str[i] == c)
return (1);
}
return (0);
}

BIN
libftx/extra/ft_is_in.o Normal file

Binary file not shown.

28
libftx/extra/ft_strchri.c Normal file
View File

@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/05 19:22:58 by cchauvet #+# #+# */
/* Updated: 2023/01/05 19:23:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "extra.h"
ssize_t ft_strchri(char *str, char c)
{
size_t i;
if (str == NULL)
return (-1);
i = 0;
while (str[i] != c && str[i] != '\0')
i++;
if (str[i] == '\0')
return (-1);
return (i);
}

BIN
libftx/extra/ft_strchri.o Normal file

Binary file not shown.

BIN
libftx/extra/ft_strcmp.o Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 14:06:04 by cchauvet #+# #+# */
/* Updated: 2023/01/04 14:17:40 by cchauvet ### ########.fr */
/* Updated: 2023/01/05 19:38:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,17 +14,20 @@
char *ft_strfjoin(char *s1, char *s2)
{
size_t i;
size_t y;
ssize_t i;
ssize_t y;
char *out;
out = malloc((ft_strlen(s1) + ft_strlen(s2) + 1) * sizeof(char));
if (out == NULL)
return (NULL);
i = -1;
i = 0;
if (s1 != NULL)
while (s1[++i] != '\0')
while (s1[i] != '\0')
{
out[i] = s1[i];
i++;
}
free(s1);
y = -1;
if (s2 != NULL)

BIN
libftx/extra/ft_strfjoin.o Normal file

Binary file not shown.

BIN
libftx/extra/ft_strmerger.o Normal file

Binary file not shown.

32
libftx/extra/ft_strndup.c Normal file
View File

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strndup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/26 00:55:44 by cchauvet #+# #+# */
/* Updated: 2023/01/05 19:27:03 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "extra.h"
char *ft_strndup(char *src, size_t n)
{
char *out;
size_t i;
if (src[0] == '\0')
return (NULL);
out = ft_calloc(n + 1, sizeof(char));
if (out == NULL)
return (NULL);
i = 0;
while (src[i] != '\0' && i < n)
{
out[i] = src[i];
i++;
}
return (out);
}

BIN
libftx/extra/ft_strndup.o Normal file

Binary file not shown.

Binary file not shown.