This commit is contained in:
Etienne Rey-bethbeder 2022-10-17 17:03:07 +02:00
parent b891447a0d
commit d73f6e1a03
5 changed files with 17 additions and 11 deletions

View file

@ -6,7 +6,7 @@
# By: erey-bet <marvin@42.fr> +#+ +:+ +#+ # # By: erey-bet <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2022/09/27 04:19:30 by erey-bet #+# #+# # # Created: 2022/09/27 04:19:30 by erey-bet #+# #+# #
# Updated: 2022/10/14 22:38:25 by erey-bet ### ########.fr # # Updated: 2022/10/15 15:06:59 by erey-bet ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -18,13 +18,16 @@ 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 \ ft_striteri.c ft_putchar_fd.c ft_putstr_fd.c ft_putendl_fd.c ft_putnbr_fd.c \
ft_get_size.c ft_power.c ft_get_size.c ft_power.c
OBJS = ${SRCS:.c=.o} OBJS = ${SRCS:.c=.o}
BONUS = ft_lstnew.c ft_lstadd_front.c ft_lstsize.c ft_lstlast.c \ BONUS_SRCS = 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 ft_lstadd_back.c ft_lstdelone.c ft_lstclear.c ft_lstiter.c ft_lstmap.c
BONUS_OBJS = ${BONUS:.c=.o} BONUS_OBJS = ${BONUS_SRCS:.c=.o}
CC = gcc CC = gcc
CFLAGS = -Wall -Wextra -Werror CFLAGS = -Wall -Wextra -Werror
NAME = libft.a NAME = libft.a
ifdef BONUS
SRCS += ${BONUS_SRCS}
endif
all: ${NAME} all: ${NAME}
@ -42,8 +45,8 @@ fclean: clean
re: fclean all re: fclean all
bonus: ${BONUS_OBJS} bonus:
ar -rc ${NAME} ${BONUS_OBJS} @make BONUS=1
coffee: coffee:
@clear @clear

View file

@ -14,8 +14,10 @@
static int ft_isspace(char c) static int ft_isspace(char c)
{ {
return (c == ' ' || c == '\f' if (c == ' ' || c == '\f'
||c == '\n' || c == '\r' || c == '\t' || c == '\v'); ||c == '\n' || c == '\r' || c == '\t' || c == '\v')
return (1);
return (0);
} }
int ft_atoi(const char *nptr) int ft_atoi(const char *nptr)

View file

@ -6,11 +6,11 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/26 14:46:33 by erey-bet #+# #+# */ /* Created: 2022/09/26 14:46:33 by erey-bet #+# #+# */
/* Updated: 2022/09/26 16:23:39 by erey-bet ### ########.fr */ /* Updated: 2022/10/15 23:31:18 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include <stddef.h> #include "libft.h"
void *ft_memset(void *ptr, int v, size_t count) void *ft_memset(void *ptr, int v, size_t count)
{ {

View file

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/05 10:22:16 by erey-bet #+# #+# */ /* Created: 2022/10/05 10:22:16 by erey-bet #+# #+# */
/* Updated: 2022/10/10 22:49:10 by erey-bet ### ########.fr */ /* Updated: 2022/10/17 13:50:20 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,7 +18,7 @@ void ft_putnbr_fd(int n, int fd)
long nl; long nl;
nl = n; nl = n;
nl *= (n > 0) - (n < 0); nl *= ABS(nl);
len = ft_get_size(nl); len = ft_get_size(nl);
if (n < 0) if (n < 0)
ft_putchar_fd('-', fd); ft_putchar_fd('-', fd);

View file

@ -14,6 +14,7 @@
# define LIBFT_H # define LIBFT_H
# include <stdlib.h> # include <stdlib.h>
# include <unistd.h> # include <unistd.h>
# define ABS(X) (X > 0) - (X < 0)
typedef struct s_list typedef struct s_list
{ {