This commit is contained in:
Camille Chauvet
2023-01-04 20:07:13 +01:00
parent b2dfb505bd
commit 909bb442b6
81 changed files with 500 additions and 77 deletions

View File

@ -2,7 +2,7 @@ OBJ = ${SRC:.c=.o}
NAME = libftx.a
LIBS = libft/libft.a gnl/get_next_line.a printf/ft_printf.a
LIBS = libft/libft.a gnl/get_next_line.a printf/ft_printf.a extra/extra.a
CC = clang
@ -11,18 +11,21 @@ FLAG = -Wall -Wextra -Werror
all: ${NAME}
${NAME}: ${OBJ}
make -C extra
make -C libft
make -C gnl
make -C printf
ar -rcT $(NAME) $(LIBS)
clean:
make -C extra clean
make -C libft clean
make -C gnl clean
make -C printf clean
fclean: clean
rm -f ${NAME}
make -C extra fclean
make -C libft fclean
make -C printf fclean
make -C gnl fclean

39
libftx/extra/Makefile Normal file
View File

@ -0,0 +1,39 @@
:# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
# Updated: 2023/01/04 20:00:03 by cchauvet ### ########.fr #
# #
# **************************************************************************** #
CC = clang
SRCS = ft_strcmp.c ft_strfjoin.c ft_strmerger.c
OBJS = $(SRCS:.c=.o)
NAME = extra.a
CFLAGS = -Wall -Werror -Wextra
%.o: %.c extra.h
$(CC) $(CFLAGS) -c -o $@ $<
all: $(NAME)
$(NAME): $(OBJS)
ar -rc $(NAME) $(OBJS)
clean:
rm -f $(OBJS) $(BOBJS)
fclean: clean
rm -f $(NAME)
re: fclean all
.PHONY: all bonus clean fclean re

BIN
libftx/extra/extra.a Normal file

Binary file not shown.

22
libftx/extra/extra.h Normal file
View File

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* extra.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 14:03:10 by cchauvet #+# #+# */
/* Updated: 2023/01/04 19:59:10 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef EXTRA_H
# define EXTRA_H
# include <stdarg.h>
# include <stdlib.h>
# include "../libft/libft.h"
char *ft_strfjoin(char *s1, char *s2);
char *ft_strmerger(size_t arg_len, ...);
int ft_strcmp(char *s1, char *s2);
#endif

20
libftx/extra/ft_strcmp.c Normal file
View File

@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 19:20:47 by cchauvet #+# #+# */
/* Updated: 2023/01/04 19:22:20 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "extra.h"
int ft_strcmp(char *s1, char *s2)
{
while (*s1 == *s2 && *s1 != '\0')
s1++;
return (*s1 - *s2);
}

BIN
libftx/extra/ft_strcmp.o Normal file

Binary file not shown.

View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strfjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* 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 */
/* */
/* ************************************************************************** */
#include "extra.h"
char *ft_strfjoin(char *s1, char *s2)
{
size_t i;
size_t y;
char *out;
out = malloc((ft_strlen(s1) + ft_strlen(s2) + 1) * sizeof(char));
if (out == NULL)
return (NULL);
i = -1;
if (s1 != NULL)
while (s1[++i] != '\0')
out[i] = s1[i];
free(s1);
y = -1;
if (s2 != NULL)
while (s2[++y] != '\0')
out[i + y] = s2[y];
free(s2);
out[i + y] = '\0';
return (out);
}

BIN
libftx/extra/ft_strfjoin.o Normal file

Binary file not shown.

View File

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strmerger.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 15:09:15 by cchauvet #+# #+# */
/* Updated: 2023/01/04 15:24:17 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "extra.h"
char *ft_strmerger(size_t arg_len, ...)
{
va_list va;
char *out;
char *temp;
va_start(va, arg_len);
out = ft_strjoin(va_arg(va, char *), va_arg(va, char *));
while (arg_len > 2)
{
temp = ft_strjoin(out, va_arg(va, char *));
free(out);
if (temp == NULL)
return (NULL);
out = temp;
arg_len--;
}
return (out);
}

BIN
libftx/extra/ft_strmerger.o Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/14 15:38:06 by cchauvet #+# #+# */
/* Updated: 2022/11/14 17:28:39 by cchauvet ### ########.fr */
/* Updated: 2023/01/04 20:05:54 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,11 +6,11 @@
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
# Updated: 2022/10/28 19:51:46 by cchauvet ### ########.fr #
# Updated: 2023/01/04 15:35:42 by cchauvet ### ########.fr #
# #
# **************************************************************************** #
CC = gcc
CC = clang
SRCS = ft_isalpha.c \
ft_isdigit.c \

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/26 14:47:54 by cchauvet #+# #+# */
/* Updated: 2022/10/21 15:02:44 by cchauvet ### ########.fr */
/* Updated: 2023/01/04 15:20:30 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -58,10 +58,10 @@ typedef struct s_list
} t_list;
t_list *ft_lstnew(void *content);
void ft_lstadd_front(t_list **lst, t_list *new);
void ft_lstadd_front(t_list **lst, t_list *nouveau);
int ft_lstsize(t_list *lst);
t_list *ft_lstlast(t_list *lst);
void ft_lstadd_back(t_list **lst, t_list *new);
void ft_lstadd_back(t_list **lst, t_list *nouveau);
void ft_lstdelone(t_list *lst, void (*del)(void *));
void ft_lstclear(t_list **lst, void (*del)(void *));
void ft_lstiter(t_list *lst, void (*f)(void *));

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/26 14:47:54 by cchauvet #+# #+# */
/* Updated: 2022/12/14 16:05:13 by cchauvet ### ########.fr */
/* Updated: 2023/01/04 20:07:06 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,10 +14,15 @@
# define LIBFTX_H
# include <stdlib.h>
# include <unistd.h>
# include <stdarg.h>
int ft_printf(const char *format, ...);
char *get_next_line(int fd);
char *ft_strfjoin(char *s1, char *s2);
char *ft_strmerger(size_t arg_len, ...);
int ft_strcmp(char *s1, char *s2);
int ft_atoi(const char *nptr);
void ft_bzero(void *s, size_t n);
void *ft_calloc(size_t nmemb, size_t size);

View File

@ -6,9 +6,12 @@
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
# Updated: 2022/12/14 16:15:10 by cchauvet ### ########.fr #
# Updated: 2023/01/04 15:36:08 by cchauvet ### ########.fr #
# #
# **************************************************************************** #
CC = clang
SRCS = ft_dprintul_base.c ft_isdigit.c ft_dprintul.c ft_dprintx.c ft_dprintflag.c ft_skipflag.c ft_vdprintf.c ft_dprintl_base.c ft_dprintX.c ft_dprintptr.c ft_strlen.c ft_putstr_fd.c ft_dprintarg.c ft_printf.c ft_putchar_fd.c ft_isarg.c
OBJS = ${SRCS:.c=.o}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.