aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-15 16:23:11 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-16 08:13:42 +0100
commitd0c146c2274198814e106b17ea1f9461a1b0b81a (patch)
tree7e348bed6a2f625ce3601a8cb7a0ef977e81ef16
parente0f11e486518930e82e67f2dc305595671c074b5 (diff)
downloadlibft-d0c146c2274198814e106b17ea1f9461a1b0b81a.tar.gz
libft-d0c146c2274198814e106b17ea1f9461a1b0b81a.tar.bz2
libft-d0c146c2274198814e106b17ea1f9461a1b0b81a.zip
Linux OPEN_MAX
-rw-r--r--Makefile5
-rw-r--r--ft_putchar_fd.c3
-rw-r--r--ft_putendl_fd.c1
-rw-r--r--ft_putnbr_fd.c2
-rw-r--r--ft_putstr_fd.c3
-rw-r--r--get_next_line.c4
-rw-r--r--get_next_line.h3
-rw-r--r--libft.h10
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 <unistd.h>
-#include <limits.h>
+#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 <limits.h>
#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 <unistd.h>
-#include <limits.h>
#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 <unistd.h>
-#include <limits.h>
+#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 <unistd.h>
-#include <stdlib.h>
-#include <limits.h>
-#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 <unistd.h>
+# include <stdlib.h>
# include <limits.h>
+# 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 <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <unistd.h>
# include <string.h>
+# include <limits.h>
# include "get_next_line.h"
+# ifdef LINUX
+# include <stdio.h>
+# 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