Archived
1
0

finished day

This commit is contained in:
Adam Joly
2023-11-09 18:28:02 +01:00
parent c29637ab4d
commit 12a7b354b9
36 changed files with 84 additions and 16 deletions

BIN
ft_atoi.o Normal file

Binary file not shown.

BIN
ft_bzero.o Normal file

Binary file not shown.

BIN
ft_calloc.o Normal file

Binary file not shown.

BIN
ft_isalnum.o Normal file

Binary file not shown.

BIN
ft_isalpha.o Normal file

Binary file not shown.

BIN
ft_isascii.o Normal file

Binary file not shown.

BIN
ft_isdigit.o Normal file

Binary file not shown.

BIN
ft_isprint.o Normal file

Binary file not shown.

BIN
ft_itoa.o Normal file

Binary file not shown.

View File

@ -6,26 +6,22 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/05 14:52:53 by adjoly #+# #+# */
/* Updated: 2023/11/08 14:52:06 by adjoly ### ########.fr */
/* Updated: 2023/11/09 14:27:32 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#define BUFFER_SIZE 10
void *ft_memchr(const void *s, int c, size_t n)
{
size_t i;
i = 0;
while (((char *)s)[i] && i < n)
while (i < n)
{
if (((char *)s)[i] == (char)c)
return (((char *)s + i));
if (((unsigned char *)s)[i] == (unsigned char)c)
return (((void *)s + i));
i++;
}
if (c == 0)
return (((char *)s) + i);
return (NULL);
}

BIN
ft_memchr.o Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/08 12:04:48 by adjoly #+# #+# */
/* Updated: 2023/11/08 12:16:47 by adjoly ### ########.fr */
/* Updated: 2023/11/09 14:06:17 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,6 +18,8 @@ int ft_memcmp(const void *s1, const void *s2, size_t n)
size_t i;
i = 0;
if (n == 0)
return (0);
while (((unsigned char *)s1)[i] == ((unsigned char *)s2)[i] && i < n - 1)
i++;
return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]);

BIN
ft_memcmp.o Normal file

Binary file not shown.

BIN
ft_memcpy.o Normal file

Binary file not shown.

BIN
ft_memmove.o Normal file

Binary file not shown.

BIN
ft_memset.o Normal file

Binary file not shown.

BIN
ft_putchar_fd.o Normal file

Binary file not shown.

BIN
ft_putnbr_fd.o Normal file

Binary file not shown.

BIN
ft_putstr_fd.o Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */
/* Updated: 2023/11/08 14:31:21 by adjoly ### ########.fr */
/* Updated: 2023/11/09 14:31:55 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,5 +19,7 @@ char *ft_strchr(const char *s, int c)
len_s = ft_strlen(s);
result = ft_memchr(s, c, len_s);
if (c == 0)
return ((char *)s + len_s);
return (result);
}

BIN
ft_strchr.o Normal file

Binary file not shown.

BIN
ft_strdup.o Normal file

Binary file not shown.

BIN
ft_strjoin.o Normal file

Binary file not shown.

BIN
ft_strlcat.o Normal file

Binary file not shown.

BIN
ft_strlcpy.o Normal file

Binary file not shown.

BIN
ft_strlen.o Normal file

Binary file not shown.

BIN
ft_strncmp.o Normal file

Binary file not shown.

36
ft_strnstr.c Normal file
View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/08 16:02:17 by adjoly #+# #+# */
/* Updated: 2023/11/09 13:58:30 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnstr(const char *big, const char *little, size_t len)
{
size_t i;
size_t j;
i = 0;
j = 0;
if (!little || big == little)
return ((char *)big);
if (len <= 0)
return (0);
while (i < len && big[i])
{
j = 0;
while (i + j < len && big[i + j] == little[j])
j++;
if (little[j] == 0)
return ((char *)big + i);
i++;
}
return (NULL);
}

BIN
ft_strnstr.o Normal file

Binary file not shown.

33
ft_strrchr.c Normal file
View File

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/08 14:44:26 by adjoly #+# #+# */
/* Updated: 2023/11/08 15:21:28 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strrchr(const char *s, int c)
{
size_t i;
size_t len_s;
len_s = ft_strlen(s);
i = len_s;
if (c == 0)
return (&((char *)s)[len_s]);
while (i > 0)
{
if (s[i] == (char)c)
return (&((char *)s)[i]);
i--;
}
if (s[0] == (char)c)
return (&((char *)s)[0]);
return (NULL);
}

BIN
ft_strrchr.o Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/02 17:59:58 by adjoly #+# #+# */
/* Updated: 2023/11/05 12:14:35 by adjoly ### ########.fr */
/* Updated: 2023/11/09 15:02:46 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,15 +18,14 @@ char *ft_substr(char const *s, unsigned int start, size_t len)
char *result;
i = 0;
if (s == NULL || len == 0)
if (s == NULL)
return (NULL);
if (start >= ft_strlen(s))
if (start > ft_strlen(s))
{
result = malloc(1);
result[0] = '\0';
result = calloc(1, 1);
return (result);
}
result = malloc((len + 1) * sizeof(char));
result = malloc(((ft_strlen(s) - len) + 1) * sizeof(char));
if (result == NULL)
return (NULL);
while (i < len && s[start + i])

BIN
ft_substr.o Normal file

Binary file not shown.

BIN
ft_tolower.o Normal file

Binary file not shown.

BIN
ft_toupper.o Normal file

Binary file not shown.

BIN
libft.a Normal file

Binary file not shown.