first commit
This commit is contained in:
56
Makefile
Normal file
56
Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# ::: :::::::: #
|
||||
# Makefile :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2023/11/01 11:03:22 by adjoly #+# #+# #
|
||||
# Updated: 2023/11/03 11:59:46 by adjoly ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
NAME = libft.a
|
||||
|
||||
CC = cc
|
||||
|
||||
SRCS = ft_atoi.c \
|
||||
ft_bzero.c \
|
||||
ft_isalnum.c \
|
||||
ft_isalpha.c \
|
||||
ft_isascii.c \
|
||||
ft_isdigit.c \
|
||||
ft_putchar_fd.c \
|
||||
ft_putnbr_fd.c \
|
||||
ft_putstr_fd.c \
|
||||
ft_memcpy.c \
|
||||
ft_memset.c \
|
||||
ft_strlcpy.c \
|
||||
ft_strlen.c \
|
||||
ft_substr.c \
|
||||
ft_tolower.c \
|
||||
ft_toupper.c \
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
FLAGS = -Werror -Wall -Wextra
|
||||
|
||||
HEADER = libft.h
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
ar -rcs $(NAME) $(OBJS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(FLAGS) -I $(HEADER) $< -c -o $@
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: clean all re fclean
|
37
ft_atoi.c
Normal file
37
ft_atoi.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_atoi.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 09:00:27 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/01 17:15:05 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_atoi(const char *nptr)
|
||||
{
|
||||
int i;
|
||||
int sign;
|
||||
int nbr;
|
||||
|
||||
i = 0;
|
||||
sign = 1;
|
||||
nbr = 0;
|
||||
while ((nptr[i] >= 7 && nptr[i] <= 13) || nptr[i] == 32)
|
||||
i++;
|
||||
if (nptr[i] == '-')
|
||||
{
|
||||
sign *= -1;
|
||||
i++;
|
||||
}
|
||||
else if (nptr[i] == '+')
|
||||
i++;
|
||||
while (nptr[i] >= '0' && nptr[i] <= '9')
|
||||
{
|
||||
nbr = nbr * 10 + (nptr[i] - '0');
|
||||
i++;
|
||||
}
|
||||
return (nbr * sign);
|
||||
}
|
18
ft_bzero.c
Normal file
18
ft_bzero.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_bzero.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/03 11:58:03 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 12:03:51 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_bzero(void *s, size_t n)
|
||||
{
|
||||
ft_memset(s, '\0', n);
|
||||
}
|
BIN
ft_bzero.o
Normal file
BIN
ft_bzero.o
Normal file
Binary file not shown.
18
ft_calloc.c
Normal file
18
ft_calloc.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_calloc.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/01 16:02:26 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/01 16:06:22 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void *calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
|
||||
}
|
19
ft_isalnum.c
Normal file
19
ft_isalnum.c
Normal file
@ -0,0 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isalnum.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 08:31:10 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 11:49:58 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_isalnum(int c)
|
||||
{
|
||||
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
|
||||
|| (c >= '0' && c <= '9'))
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
BIN
ft_isalnum.o
Normal file
BIN
ft_isalnum.o
Normal file
Binary file not shown.
18
ft_isalpha.c
Normal file
18
ft_isalpha.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isalpha.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 08:31:10 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 11:52:37 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_isalpha(int c)
|
||||
{
|
||||
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
BIN
ft_isalpha.o
Normal file
BIN
ft_isalpha.o
Normal file
Binary file not shown.
18
ft_isascii.c
Normal file
18
ft_isascii.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isascii.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 08:31:10 by adjoly #+# #+# */
|
||||
/* Updated: 2023/10/31 08:46:18 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_isascii(int c)
|
||||
{
|
||||
if (c >= 0 && c <= 127)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
BIN
ft_isascii.o
Normal file
BIN
ft_isascii.o
Normal file
Binary file not shown.
18
ft_isdigit.c
Normal file
18
ft_isdigit.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isdigit.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 08:50:01 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 11:53:33 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_isdigit(int c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
BIN
ft_isdigit.o
Normal file
BIN
ft_isdigit.o
Normal file
Binary file not shown.
30
ft_memcpy.c
Normal file
30
ft_memcpy.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_memcpy.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/02 10:21:55 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/02 11:30:30 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void *ft_memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
i = 0;
|
||||
if (src == NULL || dest == NULL || n == 0)
|
||||
{
|
||||
return (dest);
|
||||
}
|
||||
while (i < n)
|
||||
{
|
||||
((unsigned char *)dest)[i] = ((unsigned char *)src)[i];
|
||||
i++;
|
||||
}
|
||||
return (dest);
|
||||
}
|
BIN
ft_memcpy.o
Normal file
BIN
ft_memcpy.o
Normal file
Binary file not shown.
18
ft_memmove.c
Normal file
18
ft_memmove.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_memmove.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/03 15:04:04 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 15:57:15 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void *ft_memmove(void *dest, const void *src, size_t n)
|
||||
{
|
||||
|
||||
}
|
26
ft_memset.c
Normal file
26
ft_memset.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_memset.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 17:40:22 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 12:11:08 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void *ft_memset(void *s, int c, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
i = 0;
|
||||
while (i < n)
|
||||
{
|
||||
((char *)(s))[i] = c;
|
||||
i++;
|
||||
}
|
||||
return (s);
|
||||
}
|
BIN
ft_memset.o
Normal file
BIN
ft_memset.o
Normal file
Binary file not shown.
18
ft_putchar_fd.c
Normal file
18
ft_putchar_fd.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putchar_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 11:42:17 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/01 17:15:09 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_putchar_fd(char c, int fd)
|
||||
{
|
||||
write(fd, &c, 1);
|
||||
}
|
BIN
ft_putchar_fd.o
Normal file
BIN
ft_putchar_fd.o
Normal file
Binary file not shown.
38
ft_putnbr_fd.c
Normal file
38
ft_putnbr_fd.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putnbr_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 11:52:46 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 11:54:29 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_putnbr_fd(int n, int fd)
|
||||
{
|
||||
unsigned int nbr;
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
write(fd, "-", 1);
|
||||
nbr = -n;
|
||||
}
|
||||
else
|
||||
nbr = n;
|
||||
if (nbr < 10)
|
||||
write(fd, &(char){nbr + '0'}, 1);
|
||||
else
|
||||
{
|
||||
ft_putnbr_fd(nbr / 10, fd);
|
||||
write(fd, &(char){(nbr + '0') % 10}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// int main(void)
|
||||
// {
|
||||
// ft_putnbr_fd(10, 1);
|
||||
// }
|
BIN
ft_putnbr_fd.o
Normal file
BIN
ft_putnbr_fd.o
Normal file
Binary file not shown.
25
ft_putstr_fd.c
Normal file
25
ft_putstr_fd.c
Normal file
@ -0,0 +1,25 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_putstr_fd.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 11:45:55 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/01 17:14:02 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_putstr_fd(char *s, int fd)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (s[i])
|
||||
{
|
||||
write(fd, &s[i], 1);
|
||||
i++;
|
||||
}
|
||||
}
|
BIN
ft_putstr_fd.o
Normal file
BIN
ft_putstr_fd.o
Normal file
Binary file not shown.
34
ft_strchr.c
Normal file
34
ft_strchr.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strchr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/02 10:08:05 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
char *ft_strchr(const char *s, int c)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
char *str_result;
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (s[i] != c || s[i])
|
||||
i++;
|
||||
if (s[i] == c)
|
||||
{
|
||||
while (s[i])
|
||||
{
|
||||
str_result[j] = s[j + i];
|
||||
j++;
|
||||
}
|
||||
return (str_result);
|
||||
}
|
||||
str_result[0] = '\0';
|
||||
return (str_result);
|
||||
}
|
18
ft_strlcat.c
Normal file
18
ft_strlcat.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strlcat.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/03 15:59:31 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 16:03:46 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include 'libft.h'
|
||||
|
||||
size_t strlcat(char *dst, const char *src, size_t size)
|
||||
{
|
||||
|
||||
}
|
28
ft_strlcpy.c
Normal file
28
ft_strlcpy.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strlcpy.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/01 09:52:45 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 16:15:47 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
size_t ft_strlcpy(char *dst, const char *src, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
i = 0;
|
||||
while (i < size - 1 && src[i])
|
||||
{
|
||||
dst[i] = src[i];
|
||||
i++;
|
||||
}
|
||||
if (i < size)
|
||||
dst[i] = '\0';
|
||||
return (ft_strlen(src));
|
||||
}
|
BIN
ft_strlcpy.o
Normal file
BIN
ft_strlcpy.o
Normal file
Binary file not shown.
23
ft_strlen.c
Normal file
23
ft_strlen.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strlen.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/30 18:15:57 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/01 17:15:12 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
size_t ft_strlen(const char *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (s[i])
|
||||
i++;
|
||||
return (i);
|
||||
}
|
BIN
ft_strlen.o
Normal file
BIN
ft_strlen.o
Normal file
Binary file not shown.
39
ft_substr.c
Normal file
39
ft_substr.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_substr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/02 17:59:58 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 09:56:01 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
char *ft_substr(char const *s, unsigned int start, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
char *result;
|
||||
|
||||
i = 0;
|
||||
if (s == NULL || len == 0)
|
||||
return (NULL);
|
||||
if (start >= ft_strlen(s))
|
||||
{
|
||||
result = malloc(1);
|
||||
result[0] = '\0';
|
||||
return (result);
|
||||
}
|
||||
result = malloc(len * sizeof(char));
|
||||
if (result == NULL)
|
||||
return (NULL);
|
||||
while (i < len && s[start + i])
|
||||
{
|
||||
result[i] = s[start + i];
|
||||
i++;
|
||||
}
|
||||
result[i] = '\0';
|
||||
return (result);
|
||||
}
|
BIN
ft_substr.o
Normal file
BIN
ft_substr.o
Normal file
Binary file not shown.
18
ft_tolower.c
Normal file
18
ft_tolower.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_tolower.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 17:15:28 by adjoly #+# #+# */
|
||||
/* Updated: 2023/10/31 17:26:10 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_tolower(int c)
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return (c + 32);
|
||||
return (c);
|
||||
}
|
BIN
ft_tolower.o
Normal file
BIN
ft_tolower.o
Normal file
Binary file not shown.
18
ft_toupper.c
Normal file
18
ft_toupper.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_toupper.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 17:15:28 by adjoly #+# #+# */
|
||||
/* Updated: 2023/10/31 17:26:15 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int ft_toupper(int c)
|
||||
{
|
||||
if (c >= 'a' && c <= 'z')
|
||||
return (c - 32);
|
||||
return (c);
|
||||
}
|
BIN
ft_toupper.o
Normal file
BIN
ft_toupper.o
Normal file
Binary file not shown.
40
libft.h
Normal file
40
libft.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* libft.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/01 10:06:03 by adjoly #+# #+# */
|
||||
/* Updated: 2023/11/03 15:57:10 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef LIBFT_H
|
||||
# define LIBFT_H
|
||||
|
||||
# include <stddef.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
|
||||
int ft_atoi(const char *nptr);
|
||||
void *ft_calloc(size_t nmemb, size_t size);
|
||||
int ft_isalnum(int c);
|
||||
int ft_isalpha(int c);
|
||||
int ft_isascii(int c);
|
||||
int ft_isdigit(int c);
|
||||
void ft_bzero(void *s, size_t n);
|
||||
void *ft_memset(void *s, int c, size_t n);
|
||||
void *ft_memmove(void *dest, const void *src, size_t n);
|
||||
void *ft_memcpy(void *dest, const void *src, size_t n);
|
||||
void ft_putchar_fd(char c, int fd);
|
||||
void ft_putnbr_fd(int n, int fd);
|
||||
void ft_putstr_fd(char *s, int fd);
|
||||
char *ft_strchr(const char *s, int c);
|
||||
size_t ft_strlcpy(char *dst, const char *src, size_t size);
|
||||
size_t ft_strlen(const char *s);
|
||||
char *ft_substr(char const *s, unsigned int start, size_t len);
|
||||
int ft_tolower(int c);
|
||||
int ft_toupper(int c);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user