From d0c146c2274198814e106b17ea1f9461a1b0b81a Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Nov 2019 16:23:11 +0100 Subject: Linux OPEN_MAX --- Makefile | 5 ++++- ft_putchar_fd.c | 3 +-- ft_putendl_fd.c | 1 - ft_putnbr_fd.c | 2 -- ft_putstr_fd.c | 3 +-- get_next_line.c | 4 ---- get_next_line.h | 3 +++ libft.h | 10 +++++++++- 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index b7ad478..b7f8641 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,10 @@ RM = rm -f CC = gcc CCFLAGS = -Wall -Wextra -Werror +ifeq ($(shell uname),Linux) + CCFLAGS += -D LINUX +endif + NAME = libft.a SRC = ft_atoi.c ft_bzero.c ft_isalnum.c ft_isalpha.c ft_isascii.c ft_isdigit.c \ ft_isprint.c ft_itoa.c ft_memalloc.c ft_memccpy.c ft_memchr.c \ @@ -29,7 +33,6 @@ SRC = ft_atoi.c ft_bzero.c ft_isalnum.c ft_isalpha.c ft_isascii.c ft_isdigit.c \ ft_strrchr.c ft_split.c ft_strstr.c ft_substr.c ft_strtrim.c \ ft_tolower.c ft_toupper.c ft_strlcpy.c ft_calloc.c ft_strndup.c \ ft_strjoin_free.c ft_strjoin_free_snd.c get_next_line.c ft_strcount.c - OBJ = $(SRC:.c=.o) INCLUDE = libft.h diff --git a/ft_putchar_fd.c b/ft_putchar_fd.c index a06b8b1..78d94a8 100644 --- a/ft_putchar_fd.c +++ b/ft_putchar_fd.c @@ -10,8 +10,7 @@ /* */ /* ************************************************************************** */ -#include -#include +#include "libft.h" void ft_putchar_fd(char c, int fd) { diff --git a/ft_putendl_fd.c b/ft_putendl_fd.c index 8b77884..399b03e 100644 --- a/ft_putendl_fd.c +++ b/ft_putendl_fd.c @@ -10,7 +10,6 @@ /* */ /* ************************************************************************** */ -#include #include "libft.h" void ft_putendl_fd(char *s, int fd) diff --git a/ft_putnbr_fd.c b/ft_putnbr_fd.c index 562d289..89cae15 100644 --- a/ft_putnbr_fd.c +++ b/ft_putnbr_fd.c @@ -10,8 +10,6 @@ /* */ /* ************************************************************************** */ -#include -#include #include "libft.h" void ft_putnbr_fd(int n, int fd) diff --git a/ft_putstr_fd.c b/ft_putstr_fd.c index 1f2bbda..645c133 100644 --- a/ft_putstr_fd.c +++ b/ft_putstr_fd.c @@ -10,8 +10,7 @@ /* */ /* ************************************************************************** */ -#include -#include +#include "libft.h" void ft_putstr_fd(char *s, int fd) { diff --git a/get_next_line.c b/get_next_line.c index 61d74c0..f7d9c0e 100644 --- a/get_next_line.c +++ b/get_next_line.c @@ -10,10 +10,6 @@ /* */ /* ************************************************************************** */ -#include -#include -#include -#include "libft.h" #include "get_next_line.h" /* diff --git a/get_next_line.h b/get_next_line.h index 4afd0fb..c3962e3 100644 --- a/get_next_line.h +++ b/get_next_line.h @@ -13,7 +13,10 @@ #ifndef GET_NEXT_LINE_H # define GET_NEXT_LINE_H +# include +# include # include +# include "libft.h" # ifndef BUFFER_SIZE # define BUFFER_SIZE 32 diff --git a/libft.h b/libft.h index 1dff1c0..aedf621 100644 --- a/libft.h +++ b/libft.h @@ -6,16 +6,23 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/07 09:45:02 by cacharle #+# #+# */ -/* Updated: 2019/11/05 22:19:15 by cacharle ### ########.fr */ +/* Updated: 2019/11/16 08:12:45 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_H # define LIBFT_H +# include # include +# include # include "get_next_line.h" +# ifdef LINUX +# include +# define OPEN_MAX FOPEN_MAX +# endif + # define TRUE 1 # define FALSE 0 @@ -107,5 +114,6 @@ void ft_lstpop_front(t_list **lst, void (*del)(void *)); char *ft_strjoin_free(char const *s1, char const *s2, int free_nb); char *ft_strjoin_free_snd(char const *s1, char const *s2); +int ft_strcount(char *str, char c); #endif -- cgit