Skip to content

Commit

Permalink
Libft atualizada com printf
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-br committed Jul 14, 2022
1 parent 30fc9b2 commit ca45b30
Show file tree
Hide file tree
Showing 69 changed files with 1,260 additions and 153 deletions.
54 changes: 13 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,53 +1,25 @@
SRC = ./ft_bzero.c ft_isalnum.c ft_isalpha.c \
ft_isdigit.c ft_isprint.c ft_memcpy.c \
ft_memset.c ft_strlen.c ft_isascii.c \
ft_memmove.c ft_strlcpy.c ft_strlcat.c \
ft_toupper.c ft_tolower.c ft_strchr.c \
ft_strrchr.c ft_memchr.c ft_memcmp.c \
ft_strncmp.c ft_strnstr.c ft_atoi.c \
ft_calloc.c ft_strdup.c ft_substr.c \
ft_strjoin.c ft_strtrim.c ft_split.c \
ft_itoa.c ft_strmapi.c ft_striteri.c \
ft_putchar_fd.c ft_putstr_fd.c ft_putendl_fd.c \
ft_putnbr_fd.c \
NAME = libft.a

FLAGS = -Wall -Wextra -Werror

BONUS_SRC = ft_lstnew.c ft_lstadd_front.c \
ft_lstsize.c ft_lstlast.c \
ft_lstadd_back.c ft_lstdelone.c \
ft_lstclear.c ft_lstiter.c \
ft_lstmap.c \


H_SRC = libft.h

OBJS = ${SRC:.c=.o}

BONUS_OBJS = ${BONUS_SRC:.c=.o}

NAME = libft.a

FLAGS = -Wall -Wextra -Werror

RM = rm -f
RM = rm -f

.c.o:
cc ${FLAGS} -c $< -o ${<:.c=.o}
cc ${FLAGS} -c $< -o ${<:.c=.o} -I.

$(NAME): ${OBJS} ${H_SRC}
ar -rcs $@ $^

all: ${NAME}
make -C ./printf
mv ./printf/libftprintf.a ./$(NAME)

bonus: ${BONUS_OBJS} ${H_SRC}
ar -rsc ${NAME} $^
all: ${NAME}

clean:
${RM} ${OBJS} ${BONUS_OBJS}
${RM} ${OBJS}
make clean -C ./printf

fclean: clean
${RM} ${NAME}
fclean: clean
${RM} ${NAME}

re: fclean all
re: fclean all

.PHONY: all clean fclean re bonus
.PHONY: all clean fclean re
27 changes: 0 additions & 27 deletions README.md

This file was deleted.

54 changes: 54 additions & 0 deletions libft/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
SRC_1 = ft_bzero.c ft_isalnum.c ft_isalpha.c \
ft_isdigit.c ft_isprint.c ft_memcpy.c \
ft_memset.c ft_strlen.c ft_isascii.c \
ft_memmove.c ft_strlcpy.c ft_strlcat.c \
ft_toupper.c ft_tolower.c ft_strchr.c \
ft_strrchr.c ft_memchr.c ft_memcmp.c \
ft_strncmp.c ft_strnstr.c ft_atoi.c \
ft_calloc.c ft_strdup.c

SRC_2 = ft_substr.c ft_putnbr_fd.c \
ft_strjoin.c ft_strtrim.c ft_split.c \
ft_itoa.c ft_strmapi.c ft_striteri.c \
ft_putchar_fd.c ft_putstr_fd.c ft_putendl_fd.c

BONUS_SRC = ft_lstnew.c ft_lstadd_front.c \
ft_lstsize.c ft_lstlast.c \
ft_lstadd_back.c ft_lstdelone.c \
ft_lstclear.c ft_lstiter.c ft_lstmap.c



H_SRC = libft.h

OBJS = $(addprefix ./part_1/, ${SRC_1:.c=.o}) \
$(addprefix ./part_2/, ${SRC_2:.c=.o})

BONUS_OBJS = $(addprefix ./bonus/, ${BONUS_SRC:.c=.o})

NAME = libft.a

FLAGS = -Wall -Wextra -Werror

RM = rm -f

.c.o:
cc ${FLAGS} -c $< -o ${<:.c=.o}

$(NAME): ${OBJS} ${H_SRC}
ar -rcs $@ $^

all: ${NAME}

bonus: ${BONUS_OBJS} ${H_SRC}
ar -rsc ${NAME} $^

clean:
${RM} ${OBJS} ${BONUS_OBJS}

fclean: clean
${RM} ${NAME}

re: fclean all

.PHONY: all clean fclean re bonus
4 changes: 2 additions & 2 deletions bonus/ft_lstadd_back.c → libft/bonus/ft_lstadd_back.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/07 03:32:45 by ralves-b #+# #+# */
/* Updated: 2022/06/07 03:32:50 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:03:47 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

void ft_lstadd_back(t_list **lst, t_list *new)
{
Expand Down
4 changes: 2 additions & 2 deletions bonus/ft_lstadd_front.c → libft/bonus/ft_lstadd_front.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/07 01:55:19 by ralves-b #+# #+# */
/* Updated: 2022/06/07 01:55:21 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:03:55 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

void ft_lstadd_front(t_list **lst, t_list *new)
{
Expand Down
4 changes: 2 additions & 2 deletions bonus/ft_lstclear.c → libft/bonus/ft_lstclear.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/07 22:56:03 by ralves-b #+# #+# */
/* Updated: 2022/06/08 01:48:55 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:03:57 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

void ft_lstclear(t_list **lst, void (*del)(void*))
{
Expand Down
7 changes: 5 additions & 2 deletions bonus/ft_lstdelone.c → libft/bonus/ft_lstdelone.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/07 04:27:07 by ralves-b #+# #+# */
/* Updated: 2022/06/07 04:27:14 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:03:59 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

void ft_lstdelone(t_list *lst, void (*del)(void*))
{
Expand All @@ -19,3 +19,6 @@ void ft_lstdelone(t_list *lst, void (*del)(void*))
del(lst->content);
free(lst);
}


// 1 // 2 // // 4
4 changes: 2 additions & 2 deletions bonus/ft_lstiter.c → libft/bonus/ft_lstiter.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/08 02:53:29 by ralves-b #+# #+# */
/* Updated: 2022/06/08 02:53:35 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:01 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

void ft_lstiter(t_list *lst, void (*f)(void *))
{
Expand Down
4 changes: 2 additions & 2 deletions bonus/ft_lstlast.c → libft/bonus/ft_lstlast.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/07 02:56:19 by ralves-b #+# #+# */
/* Updated: 2022/06/07 02:58:06 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:03 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

t_list *ft_lstlast(t_list *lst)
{
Expand Down
4 changes: 2 additions & 2 deletions bonus/ft_lstmap.c → libft/bonus/ft_lstmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/08 03:12:04 by ralves-b #+# #+# */
/* Updated: 2022/06/08 17:48:43 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:04 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *))
{
Expand Down
4 changes: 2 additions & 2 deletions bonus/ft_lstnew.c → libft/bonus/ft_lstnew.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/07 00:13:11 by ralves-b #+# #+# */
/* Updated: 2022/06/07 00:13:15 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:06 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

t_list *ft_lstnew(void *content)
{
Expand Down
4 changes: 2 additions & 2 deletions bonus/ft_lstsize.c → libft/bonus/ft_lstsize.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/07 02:45:28 by ralves-b #+# #+# */
/* Updated: 2022/06/08 17:44:23 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:09 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

int ft_lstsize(t_list *lst)
{
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions part_1/ft_atoi.c → libft/part_1/ft_atoi.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/01 18:10:33 by ralves-b #+# #+# */
/* Updated: 2022/06/01 19:52:52 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:17 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

int ft_atoi(const char *nptr)
{
Expand Down
4 changes: 2 additions & 2 deletions part_1/ft_bzero.c → libft/part_1/ft_bzero.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/27 01:02:51 by ralves-b #+# #+# */
/* Updated: 2022/06/02 01:53:18 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:19 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

void ft_bzero(void *dest, size_t n)
{
Expand Down
4 changes: 2 additions & 2 deletions part_1/ft_calloc.c → libft/part_1/ft_calloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/02 01:06:29 by ralves-b #+# #+# */
/* Updated: 2022/06/03 01:52:57 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:21 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

void *ft_calloc(size_t nmemb, size_t size)
{
Expand Down
4 changes: 2 additions & 2 deletions part_1/ft_isalnum.c → libft/part_1/ft_isalnum.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/27 01:03:12 by ralves-b #+# #+# */
/* Updated: 2022/06/01 17:58:51 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:22 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

int ft_isalnum(int c)
{
Expand Down
4 changes: 2 additions & 2 deletions part_1/ft_isalpha.c → libft/part_1/ft_isalpha.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/27 01:03:23 by ralves-b #+# #+# */
/* Updated: 2022/06/01 17:53:08 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:24 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

int ft_isalpha(int c)
{
Expand Down
3 changes: 2 additions & 1 deletion part_1/ft_isascii.c → libft/part_1/ft_isascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/27 22:14:21 by ralves-b #+# #+# */
/* Updated: 2022/06/01 17:59:33 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:46 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "../libft.h"
int ft_isascii(int c)
{
return (c >= 0 && c <= 127);
Expand Down
4 changes: 2 additions & 2 deletions part_1/ft_isdigit.c → libft/part_1/ft_isdigit.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/27 01:03:31 by ralves-b #+# #+# */
/* Updated: 2022/06/01 18:01:20 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:34 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

int ft_isdigit(int c)
{
Expand Down
4 changes: 2 additions & 2 deletions part_1/ft_isprint.c → libft/part_1/ft_isprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/* By: ralves-b <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/27 01:03:39 by ralves-b #+# #+# */
/* Updated: 2022/06/01 18:08:22 by ralves-b ### ########.fr */
/* Updated: 2022/07/14 18:04:38 by ralves-b ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"
#include "../libft.h"

int ft_isprint(int c)
{
Expand Down
Loading

0 comments on commit ca45b30

Please sign in to comment.