UtilLib
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
# Nom de la bibliothèque
|
||||||
|
NAME = libft.a
|
||||||
|
|
||||||
|
# Options de compilation
|
||||||
|
CC = cc
|
||||||
|
CFLAGS = -Wall -Wextra -Werror -g3
|
||||||
|
AR = ar rcs
|
||||||
|
RM = rm -f
|
||||||
|
|
||||||
|
# Liste des fichiers source
|
||||||
|
SRCS = ft_calloc.c ft_isascii.c ft_itoa.c ft_memcpy.c ft_putchar_fd.c ft_putstr_fd.c ft_strdup.c ft_strlcat.c ft_strmapi.c ft_strrchr.c ft_tolower.c \
|
||||||
|
ft_atoi.c ft_isalnum.c ft_isdigit.c ft_memchr.c ft_memmove.c ft_putendl_fd.c ft_split.c ft_striteri.c ft_strlcpy.c ft_strncmp.c ft_strtrim.c ft_toupper.c \
|
||||||
|
ft_bzero.c ft_isalpha.c ft_isprint.c ft_memcmp.c ft_memset.c ft_putnbr_fd.c ft_strchr.c ft_strjoin.c ft_strlen.c ft_strnstr.c ft_substr.c \
|
||||||
|
gnl.c gnl_utils.c ft_is_space.c ft_strtod.c printf_fd.c
|
||||||
|
|
||||||
|
# Les fichiers objets correspondants
|
||||||
|
OBJS = ft_calloc.o ft_isascii.o ft_itoa.o ft_memcpy.o ft_putchar_fd.o ft_putstr_fd.o ft_strdup.o ft_strlcat.o ft_strmapi.o ft_strrchr.o ft_tolower.o \
|
||||||
|
ft_atoi.o ft_isalnum.o ft_isdigit.o ft_memchr.o ft_memmove.o ft_putendl_fd.o ft_split.o ft_striteri.o ft_strlcpy.o ft_strncmp.o ft_strtrim.o ft_toupper.o \
|
||||||
|
ft_bzero.o ft_isalpha.o ft_isprint.o ft_memcmp.o ft_memset.o ft_putnbr_fd.o ft_strchr.o ft_strjoin.o ft_strlen.o ft_strnstr.o ft_substr.o \
|
||||||
|
gnl.o gnl_utils.o ft_is_space.o ft_strtod.o printf_fd.o
|
||||||
|
|
||||||
|
# Règle par défaut, créer la bibliothèque
|
||||||
|
all: $(NAME)
|
||||||
|
|
||||||
|
# Règle pour créer la bibliothèque statique
|
||||||
|
$(NAME): $(OBJS)
|
||||||
|
$(AR) $(NAME) $(OBJS)
|
||||||
|
|
||||||
|
# Règle pour compiler les fichiers .c en fichiers .o
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
# Règle pour nettoyer les fichiers objets et l'exécutable
|
||||||
|
clean:
|
||||||
|
@$(RM) $(OBJS)
|
||||||
|
|
||||||
|
# Règle pour nettoyer les fichiers objets et la bibliothèque
|
||||||
|
fclean: clean
|
||||||
|
@$(RM) $(NAME)
|
||||||
|
|
||||||
|
# Règle pour tout nettoyer et recompiler
|
||||||
|
re: fclean all
|
||||||
|
|
||||||
|
# Spécifie que certaines cibles ne sont pas des fichiers réels
|
||||||
|
.PHONY: all clean fclean re
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_atoi.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/13 15:57:24 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2024/07/01 17:59:13 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
static int ft_isspace(char c)
|
||||||
|
{
|
||||||
|
if (c == '\t' || c == '\n' || c == '\v' \
|
||||||
|
|| c == '\f' || c == '\r' || c == ' ')
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ft_fsign(char c)
|
||||||
|
{
|
||||||
|
if (c == '-')
|
||||||
|
return (-1);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ft_atoi(const char *text)
|
||||||
|
{
|
||||||
|
long sign;
|
||||||
|
long number;
|
||||||
|
|
||||||
|
number = 0;
|
||||||
|
sign = 1;
|
||||||
|
while (ft_isspace(*text) == 1)
|
||||||
|
text++;
|
||||||
|
if (*text == '-' || *text == '+')
|
||||||
|
{
|
||||||
|
sign = ft_fsign(*text);
|
||||||
|
text++;
|
||||||
|
}
|
||||||
|
while (ft_isdigit(*text) == 1)
|
||||||
|
{
|
||||||
|
number *= 10;
|
||||||
|
number += *text - '0';
|
||||||
|
text++;
|
||||||
|
}
|
||||||
|
return (sign * number);
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_bzero.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/07 10:47:55 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/09 15:02:31 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void ft_bzero(void *s, size_t n)
|
||||||
|
{
|
||||||
|
if (n <= 0)
|
||||||
|
return ;
|
||||||
|
ft_memset(s, 0, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*int main()
|
||||||
|
{
|
||||||
|
void mess[10] = "oui";
|
||||||
|
|
||||||
|
ft_bzero()
|
||||||
|
return (0);
|
||||||
|
}*/
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_calloc.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/14 15:24:33 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/30 08:53:17 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void *ft_calloc(size_t n, size_t size)
|
||||||
|
{
|
||||||
|
char *tab;
|
||||||
|
size_t sizemax;
|
||||||
|
|
||||||
|
sizemax = n * size;
|
||||||
|
if (size && sizemax / size < n)
|
||||||
|
return (NULL);
|
||||||
|
if (n == 0 || size == 0)
|
||||||
|
{
|
||||||
|
tab = malloc(1);
|
||||||
|
return (tab);
|
||||||
|
}
|
||||||
|
tab = malloc(n * size);
|
||||||
|
if (!tab)
|
||||||
|
return (NULL);
|
||||||
|
ft_bzero(tab, n * size);
|
||||||
|
return (tab);
|
||||||
|
}
|
||||||
|
/*#include <limits.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
p = ft_calloc(SIZE_MAX, SIZE_MAX);
|
||||||
|
free(p);
|
||||||
|
return (0);
|
||||||
|
}*/
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_is_space.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/10/26 13:54:02 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2024/10/26 13:55:48 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_is_space(char c)
|
||||||
|
{
|
||||||
|
return (c == ' ' || c == '\t' || c == '\n' || \
|
||||||
|
c == '\v' || c == '\f' || c == '\r');
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_isalnum.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/07 10:17:01 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/08 08:05:51 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_isalnum(int c)
|
||||||
|
{
|
||||||
|
if (ft_isalpha(c) == 1 || ft_isdigit(c) == 1)
|
||||||
|
return (1);
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_isalpha.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/07 10:02:38 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/08 08:06:13 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_isalpha(int c)
|
||||||
|
{
|
||||||
|
if ((c >= 65 && c <= 90) \
|
||||||
|
|| (c >= 97 && c <= 122))
|
||||||
|
return (1);
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_isascii.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/07 10:17:41 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/08 08:06:30 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_isascii(int c)
|
||||||
|
{
|
||||||
|
if (c >= 0 && c <= 127)
|
||||||
|
return (1);
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_isdigit.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/07 10:06:07 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/08 08:06:49 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_isdigit(int c)
|
||||||
|
{
|
||||||
|
if ((c >= 48 && c <= 57) || c == 46)
|
||||||
|
return (1);
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_isprint.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/09 12:37:20 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/30 09:02:47 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_isprint(int c)
|
||||||
|
{
|
||||||
|
if (c >= 32 && c <= 126)
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_itoa.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/22 15:16:11 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/30 07:44:52 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
static int ft_n_digit(int n)
|
||||||
|
{
|
||||||
|
long index;
|
||||||
|
|
||||||
|
if (n == 0)
|
||||||
|
return (1);
|
||||||
|
index = 0;
|
||||||
|
while (n != 0)
|
||||||
|
{
|
||||||
|
n /= 10;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return (index);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ft_pow(int n)
|
||||||
|
{
|
||||||
|
long index;
|
||||||
|
|
||||||
|
index = 1;
|
||||||
|
while (n != 0)
|
||||||
|
{
|
||||||
|
index *= 10;
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
return (index / 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ft_set_number(char *tab)
|
||||||
|
{
|
||||||
|
long index;
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
while (index != 11)
|
||||||
|
{
|
||||||
|
tab[index] = index + '0';
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
tab[index] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ft_set_digit(long nbr_digit, long index, char *nbr, long n)
|
||||||
|
{
|
||||||
|
char digit[15];
|
||||||
|
long pow;
|
||||||
|
|
||||||
|
if (n == 0)
|
||||||
|
{
|
||||||
|
*nbr = '0';
|
||||||
|
*(nbr + 1) = 0;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
ft_set_number(digit);
|
||||||
|
pow = ft_pow(nbr_digit);
|
||||||
|
while (nbr_digit != 0)
|
||||||
|
{
|
||||||
|
*(nbr + index++) = digit[(n / pow) % 10];
|
||||||
|
nbr_digit--;
|
||||||
|
pow /= 10;
|
||||||
|
}
|
||||||
|
*(nbr + index++) = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ft_itoa(int n)
|
||||||
|
{
|
||||||
|
char *nbr;
|
||||||
|
long index;
|
||||||
|
long n2;
|
||||||
|
long nbr_digit;
|
||||||
|
|
||||||
|
n2 = (long) n;
|
||||||
|
nbr_digit = ft_n_digit(n);
|
||||||
|
index = 0;
|
||||||
|
if (n2 < 0)
|
||||||
|
{
|
||||||
|
nbr = ft_calloc((nbr_digit + 2), 1);
|
||||||
|
if (!nbr)
|
||||||
|
return (NULL);
|
||||||
|
*(nbr + index++) = '-';
|
||||||
|
n2 *= -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nbr = ft_calloc((nbr_digit + 1), 1);
|
||||||
|
if (!nbr)
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
ft_set_digit(nbr_digit, index, nbr, n2);
|
||||||
|
return (nbr);
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_memchr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/11 09:03:40 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2024/10/25 21:46:01 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void *ft_memchr(const void *s, int c, size_t n)
|
||||||
|
{
|
||||||
|
unsigned char *p;
|
||||||
|
size_t index;
|
||||||
|
|
||||||
|
p = (unsigned char *)s;
|
||||||
|
index = 0;
|
||||||
|
while (p[index] && index < n)
|
||||||
|
{
|
||||||
|
if (p[index] == (unsigned char) c)
|
||||||
|
return ((void *)(p + index));
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_memcmp.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/11 10:08:42 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/13 16:23:41 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_memcmp(const void *s1, const void *s2, size_t n)
|
||||||
|
{
|
||||||
|
unsigned char *p1;
|
||||||
|
unsigned char *p2;
|
||||||
|
size_t index;
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
p1 = (unsigned char *)s1;
|
||||||
|
p2 = (unsigned char *)s2;
|
||||||
|
while (index < n)
|
||||||
|
{
|
||||||
|
if (*(p1 + index) != *(p2 + index))
|
||||||
|
return ((*(p1 + index) - *(p2 + index)));
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*int main()
|
||||||
|
{
|
||||||
|
ft_memcmp("001270", "coucou", 7);
|
||||||
|
return (0);
|
||||||
|
}*/
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_memcpy.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/07 11:03:13 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/09 12:15:15 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void *ft_memcpy(void *dest, const void *src, size_t n)
|
||||||
|
{
|
||||||
|
size_t index;
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
while (index < n)
|
||||||
|
{
|
||||||
|
*(unsigned char *)(dest + index) = *(unsigned char *)(src + index);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return (dest);
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_memmove.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/08 15:13:56 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/09 12:45:23 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void *ft_memmove(void *dest, const void *src, size_t n)
|
||||||
|
{
|
||||||
|
size_t index;
|
||||||
|
int index2;
|
||||||
|
|
||||||
|
if (dest > src)
|
||||||
|
{
|
||||||
|
index2 = n - 1;
|
||||||
|
while (index2 >= 0)
|
||||||
|
{
|
||||||
|
*(unsigned char *)(dest + index2) = \
|
||||||
|
*(unsigned char *)(src + index2);
|
||||||
|
index2--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
while (index < n)
|
||||||
|
{
|
||||||
|
*(unsigned char *)(dest + index) = *(unsigned char *)(src + index);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (dest);
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_memset.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/06 11:33:18 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/09 14:55:20 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void *ft_memset(void *s, int c, size_t n)
|
||||||
|
{
|
||||||
|
size_t index;
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
while (index < n)
|
||||||
|
{
|
||||||
|
*(unsigned char *)(s + index) = c;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return (s);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putchar_fd.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/23 14:08:31 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/23 15:04:00 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void ft_putchar_fd(char c, int fd)
|
||||||
|
{
|
||||||
|
write(fd, &c, 1);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putendl_fd.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/23 14:34:12 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/24 17:45:40 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void ft_putendl_fd(char *s, int fd)
|
||||||
|
{
|
||||||
|
ft_putstr_fd(s, fd);
|
||||||
|
ft_putchar_fd('\n', fd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putnbr_fd.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/23 14:41:48 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/27 22:27:06 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
static int ft_n_digit(int n)
|
||||||
|
{
|
||||||
|
long index;
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
while (n != 0)
|
||||||
|
{
|
||||||
|
n /= 10;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return (index);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ft_pow(int n)
|
||||||
|
{
|
||||||
|
long index;
|
||||||
|
|
||||||
|
index = 1;
|
||||||
|
while (n != 0)
|
||||||
|
{
|
||||||
|
index *= 10;
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
return (index / 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ft_set_number(char *tab)
|
||||||
|
{
|
||||||
|
long index;
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
while (index != 11)
|
||||||
|
{
|
||||||
|
tab[index] = index + '0';
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
tab[index] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ft_set_digit(long nbr_digit, long n, int fd)
|
||||||
|
{
|
||||||
|
char digit[15];
|
||||||
|
long pow;
|
||||||
|
|
||||||
|
if (n == 0)
|
||||||
|
{
|
||||||
|
ft_putchar_fd('0', fd);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
ft_set_number(digit);
|
||||||
|
pow = ft_pow(nbr_digit);
|
||||||
|
while (nbr_digit != 0)
|
||||||
|
{
|
||||||
|
ft_putchar_fd(digit[(n / pow) % 10], fd);
|
||||||
|
nbr_digit--;
|
||||||
|
pow /= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ft_putnbr_fd(int n, int fd)
|
||||||
|
{
|
||||||
|
long n2;
|
||||||
|
long nbr_digit;
|
||||||
|
|
||||||
|
n2 = (long) n;
|
||||||
|
nbr_digit = ft_n_digit(n);
|
||||||
|
if (n2 < 0)
|
||||||
|
{
|
||||||
|
ft_putchar_fd('-', fd);
|
||||||
|
n2 *= -1;
|
||||||
|
}
|
||||||
|
ft_set_digit(nbr_digit, n2, fd);
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putstr_fd.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/23 14:24:20 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/23 14:32:00 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void ft_putstr_fd(char *s, int fd)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (*(s + i))
|
||||||
|
{
|
||||||
|
ft_putchar_fd(*(s + i), fd);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
+108
@@ -0,0 +1,108 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_split.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/16 17:06:15 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/29 13:19:56 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
static size_t count_word(char *str, char c)
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
while (*str)
|
||||||
|
{
|
||||||
|
while (*str == c)
|
||||||
|
str++;
|
||||||
|
if (*str != c && *str)
|
||||||
|
count++;
|
||||||
|
while (*str && *str != c)
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
return (count);
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t len_word(char *s, char c, size_t start)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (s[start] && s[start] != c)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free_array(char **s1)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (s1[i])
|
||||||
|
{
|
||||||
|
free(s1[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
free(s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char **divisor(char *str1, char c, char **array, size_t len)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
size_t j;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
j = 0;
|
||||||
|
while (i < len)
|
||||||
|
{
|
||||||
|
while (str1[j] && str1[j] == c)
|
||||||
|
j++;
|
||||||
|
array[i] = ft_substr(str1, j, len_word(str1, c, j));
|
||||||
|
if (!array[i])
|
||||||
|
{
|
||||||
|
free_array(array);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
while (str1[j] && str1[j] != c)
|
||||||
|
j++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
array[i] = NULL;
|
||||||
|
return (array);
|
||||||
|
}
|
||||||
|
|
||||||
|
char **ft_split(char const *s, char c)
|
||||||
|
{
|
||||||
|
size_t words;
|
||||||
|
char **array;
|
||||||
|
|
||||||
|
if (!s)
|
||||||
|
return (NULL);
|
||||||
|
words = count_word((char *)s, c);
|
||||||
|
array = (char **)malloc((words + 1) * (sizeof(char *)));
|
||||||
|
if (!array)
|
||||||
|
return (NULL);
|
||||||
|
array = divisor((char *)s, c, array, words);
|
||||||
|
return (array);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
char **list;
|
||||||
|
|
||||||
|
list = ft_split("--1-2--3---4----5-----42", '-');
|
||||||
|
for (int i = 0; list[i] != NULL; ++i)
|
||||||
|
free(list[i]);
|
||||||
|
free(list);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
*/
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strchr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/10 12:07:02 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/29 15:22:10 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
char *ft_strchr(const char *s, int c)
|
||||||
|
{
|
||||||
|
char *chaine;
|
||||||
|
|
||||||
|
chaine = (char *)s;
|
||||||
|
while (*chaine)
|
||||||
|
{
|
||||||
|
if (*chaine == (unsigned char)c)
|
||||||
|
return (chaine);
|
||||||
|
chaine++;
|
||||||
|
}
|
||||||
|
if (c == '\0')
|
||||||
|
return (chaine);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strdup.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/15 15:58:53 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/29 14:52:09 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
char *ft_strdup(const char *s1)
|
||||||
|
{
|
||||||
|
char *s2;
|
||||||
|
int index;
|
||||||
|
|
||||||
|
s2 = (char *)ft_calloc(ft_strlen(s1) + 1, 1);
|
||||||
|
if (s2 == NULL)
|
||||||
|
return (NULL);
|
||||||
|
index = 0;
|
||||||
|
while (*(s1 + index))
|
||||||
|
{
|
||||||
|
*(s2 + index) = *(s1 + index);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
*(s2 + index) = '\0';
|
||||||
|
return (s2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*int main()
|
||||||
|
{
|
||||||
|
char *dest;
|
||||||
|
|
||||||
|
dest = ft_strdup("BONJOUR");
|
||||||
|
dest = ft_strdup("");
|
||||||
|
dest = ft_strdup("\0");
|
||||||
|
return (0);
|
||||||
|
}*/
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_striteri.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/23 12:50:39 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/23 13:54:15 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void ft_striteri(char *s, void (*f)(unsigned int, char *))
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
f(i, s);
|
||||||
|
i++;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strjoin.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/16 12:21:11 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/30 08:49:26 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
char *ft_strjoin(char const *s1, char const *s2)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
len = ft_strlen(s1);
|
||||||
|
len += ft_strlen(s2);
|
||||||
|
str = (char *)ft_calloc((len + 1), 1);
|
||||||
|
if (!str)
|
||||||
|
return (NULL);
|
||||||
|
ft_memmove(str, s1, ft_strlen(s1));
|
||||||
|
ft_memmove((str + ft_strlen(s1)), s2, ft_strlen(s2));
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strlcat.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/09 09:02:08 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/10 09:54:44 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
size_t ft_strlcat(char *dest, const char *src, size_t size)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
size_t k;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
k = 0;
|
||||||
|
while (dest[i] && i < size)
|
||||||
|
i++;
|
||||||
|
while (src[k] && (i + k + 1) < size)
|
||||||
|
{
|
||||||
|
dest[i + k] = src[k];
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
if (i < size)
|
||||||
|
dest[i + k] = '\0';
|
||||||
|
return (i + ft_strlen(src));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*int main()
|
||||||
|
{
|
||||||
|
char mess1[10] = "oui";
|
||||||
|
char mess2[10] = "non";
|
||||||
|
|
||||||
|
ft_strlcat(mess1, mess2, 3);
|
||||||
|
return (0);
|
||||||
|
}*/
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strlcpy.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/09 17:27:30 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/09 20:22:10 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
size_t ft_strlcpy(char *dest, const char *src, size_t size)
|
||||||
|
{
|
||||||
|
size_t c;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
c = 0;
|
||||||
|
while (src[c] != '\0')
|
||||||
|
c++;
|
||||||
|
i = 0;
|
||||||
|
if (size != 0)
|
||||||
|
{
|
||||||
|
while (src[i] != '\0' && i < (size - 1))
|
||||||
|
{
|
||||||
|
dest[i] = src[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
dest[i] = '\0';
|
||||||
|
}
|
||||||
|
return (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*int main()
|
||||||
|
{
|
||||||
|
char dest[10] = "oui";
|
||||||
|
char src[3] = "non";
|
||||||
|
|
||||||
|
ft_strlcpy(dest, src, 10);
|
||||||
|
return (0);
|
||||||
|
}*/
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strlen.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/07 10:18:42 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/09 12:31:17 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
size_t ft_strlen(const char *c)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
while (c[index] != 0)
|
||||||
|
index += 1;
|
||||||
|
return (index);
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strmapi.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/23 11:52:03 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/30 09:04:01 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
char *ft_strmapi(char const *s, char (*f)(unsigned int, char))
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
str = ft_calloc((ft_strlen(s) + 1), 1);
|
||||||
|
if (!str)
|
||||||
|
return (0);
|
||||||
|
while (*(s + i))
|
||||||
|
{
|
||||||
|
*(str + i) = f(i, *(s + i));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
*(str + i) = '\0';
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strncmp.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/11 08:46:16 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2024/10/25 21:47:18 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_strncmp(const char *s1, const char *s2, size_t n)
|
||||||
|
{
|
||||||
|
size_t index;
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
while (s1[index] && s2[index] && index < n)
|
||||||
|
{
|
||||||
|
if (*(s1 + index) != *(s2 + index))
|
||||||
|
return (*(s1 + index) - *(s2 + index));
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strnstr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/12 12:16:17 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/27 22:29:37 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
char *ft_strnstr(const char *big, const char *little, size_t len)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
size_t j;
|
||||||
|
char *b;
|
||||||
|
|
||||||
|
b = (char *) big;
|
||||||
|
i = 0;
|
||||||
|
if (little[i] == '\0' || little == NULL)
|
||||||
|
return (b);
|
||||||
|
if (len == 0)
|
||||||
|
return (0);
|
||||||
|
while (b[i] != '\0' && i < len)
|
||||||
|
{
|
||||||
|
j = 0;
|
||||||
|
while (little[j] && (i + j) < len)
|
||||||
|
{
|
||||||
|
if (b[i + j] == little[j])
|
||||||
|
j++;
|
||||||
|
else
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
if (little[j] == 0)
|
||||||
|
return (&b[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
/*int main()
|
||||||
|
{
|
||||||
|
ft_strnstr("aaabcabcd", "abcd", -1);
|
||||||
|
return (0);
|
||||||
|
}*/
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strrchr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/11 08:02:01 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2023/11/29 14:34:30 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
char *ft_strrchr(const char *s, int c)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = 0;
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
len++;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
if (c == '\0' && *s == '\0')
|
||||||
|
return ((char *)s);
|
||||||
|
while (len >= 0)
|
||||||
|
{
|
||||||
|
if (*s == (unsigned char)c)
|
||||||
|
return ((char *)s);
|
||||||
|
s--;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strtod.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/10/27 16:49:09 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2024/11/13 23:04:59 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
static int partie_entiere(double *entier, char *string, int i, double *sign)
|
||||||
|
{
|
||||||
|
if (string[i] == '-')
|
||||||
|
{
|
||||||
|
*sign = -1;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
while (string[i] && ft_isdigit(string[i]))
|
||||||
|
{
|
||||||
|
*entier = *entier * 10 + (string[i] - '0');
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
//fonction qui convertie une string en double
|
||||||
|
double ft_strtod(char *string)
|
||||||
|
{
|
||||||
|
double entier;
|
||||||
|
double decimal;
|
||||||
|
double diviseur;
|
||||||
|
double sign;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
entier = 0;
|
||||||
|
decimal = 0;
|
||||||
|
diviseur = 1;
|
||||||
|
sign = 1;
|
||||||
|
i = partie_entiere(&entier, string, i, &sign);
|
||||||
|
if (string[i] == '.')
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
while (string[i] && ft_isdigit(string[i]))
|
||||||
|
{
|
||||||
|
decimal = decimal * 10 + (string[i] - '0');
|
||||||
|
diviseur *= 10;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ((entier + decimal / diviseur) * sign);
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_strtrim.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/16 13:48:16 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/29 13:09:29 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
char *ft_strtrim(char const *s1, char const *set)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
j = ft_strlen(s1) - 1;
|
||||||
|
while (s1[i] && ft_strchr(set, s1[i]))
|
||||||
|
i++;
|
||||||
|
while (s1[j] && ft_strchr(set, s1[j]))
|
||||||
|
j--;
|
||||||
|
return (ft_substr(s1, i, (j - i + 1)));
|
||||||
|
}
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_substr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/15 20:04:44 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/30 08:45:42 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
char *ft_substr(char const *s, unsigned int start, size_t len)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!s)
|
||||||
|
return (NULL);
|
||||||
|
i = 0;
|
||||||
|
if (len > ft_strlen(s) - start)
|
||||||
|
{
|
||||||
|
len = ft_strlen(s) - start;
|
||||||
|
}
|
||||||
|
if (start >= ft_strlen(s))
|
||||||
|
return (ft_strdup(""));
|
||||||
|
str = (char *)malloc(((sizeof(char) * (len + 1))));
|
||||||
|
if (!str)
|
||||||
|
return (NULL);
|
||||||
|
while (i < len && s[start] != '\0')
|
||||||
|
{
|
||||||
|
str[i++] = s[start++];
|
||||||
|
}
|
||||||
|
str[i] = '\0';
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
char *text;
|
||||||
|
|
||||||
|
text = ft_substr("tripouille", 100, 1);
|
||||||
|
free(text);
|
||||||
|
return (0);
|
||||||
|
}*/
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_tolower.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/10 10:09:46 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/10 10:13:40 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_tolower(int c)
|
||||||
|
{
|
||||||
|
if (c >= 97 - 32 && c <= 122 - 32)
|
||||||
|
return (c + 32);
|
||||||
|
return (c);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_toupper.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/10 10:05:42 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2023/11/10 10:09:20 by hexplor ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
int ft_toupper(int c)
|
||||||
|
{
|
||||||
|
if (c >= 97 && c <= 122)
|
||||||
|
return (c - 32);
|
||||||
|
return (c);
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* get_next_line.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/12/20 14:34:57 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2024/10/25 21:23:32 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef GET_NEXT_LINE_H
|
||||||
|
# define GET_NEXT_LINE_H
|
||||||
|
|
||||||
|
# include <fcntl.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
|
# ifndef BUFFER_SIZE
|
||||||
|
# define BUFFER_SIZE 42
|
||||||
|
# endif
|
||||||
|
|
||||||
|
char *get_next_line(int fd);
|
||||||
|
char *gnl_ft_getline(char *static_str);
|
||||||
|
char *gnl_ft_strjoin(char *s1, char *s2);
|
||||||
|
char *gnl_ft_strchr(char *s, int c);
|
||||||
|
size_t gnl_ft_strlen(char *s);
|
||||||
|
char *gnl_ft_remove_bn(char *static_str);
|
||||||
|
char *gnl_read_fd(int fd, char *str);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* gnl.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/12/20 14:35:58 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2024/10/25 21:47:48 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "get_next_line.h"
|
||||||
|
|
||||||
|
char *get_next_line(int fd)
|
||||||
|
{
|
||||||
|
static char *static_str;
|
||||||
|
char *line;
|
||||||
|
|
||||||
|
if (fd < 0 || BUFFER_SIZE <= 0)
|
||||||
|
return (0);
|
||||||
|
static_str = gnl_read_fd(fd, static_str);
|
||||||
|
if (!static_str)
|
||||||
|
return (NULL);
|
||||||
|
line = gnl_ft_getline(static_str);
|
||||||
|
static_str = gnl_ft_remove_bn(static_str);
|
||||||
|
return (line);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *gnl_read_fd(int fd, char *str)
|
||||||
|
{
|
||||||
|
char *tmp;
|
||||||
|
int bytes;
|
||||||
|
|
||||||
|
tmp = malloc((BUFFER_SIZE + 1) * sizeof(char));
|
||||||
|
if (!tmp)
|
||||||
|
return (NULL);
|
||||||
|
bytes = 1;
|
||||||
|
while (!gnl_ft_strchr(str, '\n') && (bytes != 0))
|
||||||
|
{
|
||||||
|
bytes = read(fd, tmp, BUFFER_SIZE);
|
||||||
|
if (bytes == -1)
|
||||||
|
{
|
||||||
|
free(tmp);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
tmp[bytes] = '\0';
|
||||||
|
str = gnl_ft_strjoin(str, tmp);
|
||||||
|
}
|
||||||
|
free(tmp);
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *gnl_ft_getline(char *static_str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char *line;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (!static_str[i])
|
||||||
|
return (NULL);
|
||||||
|
while (static_str[i] && static_str[i] != '\n')
|
||||||
|
i++;
|
||||||
|
line = (char *)malloc(sizeof(char) * (i + 2));
|
||||||
|
if (!line)
|
||||||
|
return (NULL);
|
||||||
|
i = 0;
|
||||||
|
while (static_str[i] && static_str[i] != '\n')
|
||||||
|
{
|
||||||
|
line[i] = static_str[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (static_str[i] == '\n')
|
||||||
|
{
|
||||||
|
line[i] = static_str[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
line[i] = '\0';
|
||||||
|
return (line);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *gnl_ft_remove_bn(char *static_str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
char *restof;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (static_str[i] && static_str[i] != '\n')
|
||||||
|
i++;
|
||||||
|
if (!static_str[i])
|
||||||
|
{
|
||||||
|
free(static_str);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
restof = (char *)malloc(sizeof(char) * (gnl_ft_strlen(static_str) - i + 1));
|
||||||
|
if (!restof)
|
||||||
|
return (NULL);
|
||||||
|
i++;
|
||||||
|
j = 0;
|
||||||
|
while (static_str[i])
|
||||||
|
restof[j++] = static_str[i++];
|
||||||
|
restof[j] = '\0';
|
||||||
|
free(static_str);
|
||||||
|
return (restof);
|
||||||
|
}
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* gnl_utils.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/12/20 14:34:32 by hexplor #+# #+# */
|
||||||
|
/* Updated: 2024/10/25 21:47:56 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "get_next_line.h"
|
||||||
|
|
||||||
|
size_t gnl_ft_strlen(char *s)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (!s)
|
||||||
|
return (0);
|
||||||
|
while (s[i] != '\0')
|
||||||
|
i++;
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *gnl_ft_strchr(char *s, int c)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (!s)
|
||||||
|
return (0);
|
||||||
|
if (c == '\0')
|
||||||
|
return ((char *)&s[gnl_ft_strlen(s)]);
|
||||||
|
while (s[i] != '\0')
|
||||||
|
{
|
||||||
|
if (s[i] == (char) c)
|
||||||
|
return ((char *)&s[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *gnl_ft_strjoin(char *s1, char *s2)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
size_t j;
|
||||||
|
char *str;
|
||||||
|
|
||||||
|
if (!s1)
|
||||||
|
{
|
||||||
|
s1 = (char *)malloc(1 * sizeof(char));
|
||||||
|
s1[0] = '\0';
|
||||||
|
}
|
||||||
|
if (!s1 || !s2)
|
||||||
|
return (NULL);
|
||||||
|
str = malloc(sizeof(char) * ((gnl_ft_strlen(s1) + gnl_ft_strlen(s2)) + 1));
|
||||||
|
if (str == NULL)
|
||||||
|
return (NULL);
|
||||||
|
i = -1;
|
||||||
|
j = 0;
|
||||||
|
if (s1)
|
||||||
|
while (s1[++i] != '\0')
|
||||||
|
str[i] = s1[i];
|
||||||
|
while (s2[j] != '\0')
|
||||||
|
str[i++] = s2[j++];
|
||||||
|
str[gnl_ft_strlen(s1) + gnl_ft_strlen(s2)] = '\0';
|
||||||
|
free(s1);
|
||||||
|
return (str);
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* libft.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/11/07 09:46:33 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2025/02/25 18:11:57 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef LIBFT_H
|
||||||
|
# define LIBFT_H
|
||||||
|
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <math.h>
|
||||||
|
# include <limits.h>
|
||||||
|
# include <stdarg.h>
|
||||||
|
|
||||||
|
typedef unsigned long t_lu;
|
||||||
|
typedef unsigned int t_ui;
|
||||||
|
typedef struct s_info t_info;
|
||||||
|
# define HEXUP "0123456789ABCDEF"
|
||||||
|
# define HEXLO "0123456789abcdef"
|
||||||
|
# define DEC "0123456789"
|
||||||
|
# define STR 0
|
||||||
|
# define CHAR 1
|
||||||
|
|
||||||
|
struct s_info
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
int base;
|
||||||
|
size_t i;
|
||||||
|
size_t counter;
|
||||||
|
};
|
||||||
|
|
||||||
|
void *ft_calloc(size_t count, size_t size);
|
||||||
|
|
||||||
|
void ft_putnbr_fd(int n, int fd);
|
||||||
|
|
||||||
|
void ft_putendl_fd(char *s, int fd);
|
||||||
|
|
||||||
|
void ft_striteri(char *s, void (*f)(unsigned int, char*));
|
||||||
|
|
||||||
|
void *ft_memchr(const void *s, int c, size_t n);
|
||||||
|
|
||||||
|
void *ft_memmove(void *dest, const void *src, size_t n);
|
||||||
|
|
||||||
|
void ft_putchar_fd(char c, int fd);
|
||||||
|
|
||||||
|
void ft_putstr_fd(char *s, int fd);
|
||||||
|
|
||||||
|
void *ft_memset(void *s, int c, size_t n);
|
||||||
|
|
||||||
|
void ft_bzero(void *s, size_t n);
|
||||||
|
|
||||||
|
void *ft_memcpy(void *dest, const void *src, size_t n);
|
||||||
|
|
||||||
|
size_t ft_strlcat(char *dest, const char *src, size_t size);
|
||||||
|
|
||||||
|
size_t ft_strlcpy(char *dest, const char *src, size_t size);
|
||||||
|
|
||||||
|
size_t ft_strlen(const char *c);
|
||||||
|
|
||||||
|
char **ft_split(char const *s, char c);
|
||||||
|
|
||||||
|
char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
|
||||||
|
|
||||||
|
char *ft_itoa(int n);
|
||||||
|
|
||||||
|
char *ft_strtrim(char const *s1, char const *set);
|
||||||
|
|
||||||
|
char *ft_strjoin(char const *s1, char const *s2);
|
||||||
|
|
||||||
|
char *ft_substr(char const *s, unsigned int start, size_t len);
|
||||||
|
|
||||||
|
char *ft_strdup(const char *s1);
|
||||||
|
|
||||||
|
char *ft_strchr(const char *s, int c);
|
||||||
|
|
||||||
|
char *ft_strrchr(const char *s, int c);
|
||||||
|
|
||||||
|
char *ft_strnstr(const char *big, const char *little, size_t len);
|
||||||
|
|
||||||
|
int ft_atoi(const char *str);
|
||||||
|
|
||||||
|
int ft_memcmp(const void *s1, const void *s2, size_t n);
|
||||||
|
|
||||||
|
int ft_strncmp(const char *s1, const char *s2, size_t n);
|
||||||
|
|
||||||
|
int ft_toupper(int c);
|
||||||
|
|
||||||
|
int ft_tolower(int c);
|
||||||
|
|
||||||
|
int ft_isprint(int c);
|
||||||
|
|
||||||
|
int ft_isalpha(int c);
|
||||||
|
|
||||||
|
int ft_isdigit(int c);
|
||||||
|
|
||||||
|
int ft_isalnum(int c);
|
||||||
|
|
||||||
|
int ft_isascii(int c);
|
||||||
|
|
||||||
|
int ft_is_space(char c);
|
||||||
|
|
||||||
|
double ft_strtod(char *string);
|
||||||
|
|
||||||
|
int print_double_fd(double value, int fd);
|
||||||
|
|
||||||
|
int printf_fd(int fd, const char *str, ...);
|
||||||
|
#endif
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* printf_fd.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/11/09 17:02:50 by yantoine #+# #+# */
|
||||||
|
/* Updated: 2024/11/13 23:41:20 by yantoine ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
static int putstr(char *str, char c, int is_char, t_info *info)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = 0;
|
||||||
|
if (is_char)
|
||||||
|
return (write(info->fd, &c, 1));
|
||||||
|
if (!str)
|
||||||
|
str = "(null)";
|
||||||
|
while (str[len])
|
||||||
|
len++;
|
||||||
|
return (write(info->fd, str, len));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int putnbr_b(t_lu n, char *str, int numdig, t_info *info)
|
||||||
|
{
|
||||||
|
if (n > (t_lu)info->base - 1)
|
||||||
|
numdig += putnbr_b(n / info->base, str, numdig, info);
|
||||||
|
putstr(NULL, str[n % info->base], CHAR, info);
|
||||||
|
return (++numdig);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int treat_int(int n, char *str, int numdig, t_info *info)
|
||||||
|
{
|
||||||
|
int nb;
|
||||||
|
long signal;
|
||||||
|
|
||||||
|
info->base = 10;
|
||||||
|
nb = n;
|
||||||
|
signal = 1;
|
||||||
|
if (nb < 0)
|
||||||
|
putstr(0, '-', CHAR, info);
|
||||||
|
signal = ((nb > 0) - (nb < 0));
|
||||||
|
return ((n < 0) + putnbr_b(nb * signal, str, numdig, info));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int format(const char *str, t_info *info, va_list *args)
|
||||||
|
{
|
||||||
|
if (str[info->i] == 'c')
|
||||||
|
return (putstr(0, va_arg(*args, int), CHAR, info));
|
||||||
|
if (str[info->i] == 's')
|
||||||
|
return (putstr(va_arg(*args, char *), 0, STR, info));
|
||||||
|
if (str[info->i] == 'd' || str[info->i] == 'i')
|
||||||
|
return (treat_int(va_arg(*args, int), DEC, 0, info));
|
||||||
|
if (str[info->i] == 'f')
|
||||||
|
return (print_double_fd(va_arg(*args, double), info->fd));
|
||||||
|
if (str[info->i] == 'u')
|
||||||
|
{
|
||||||
|
info->base = 10;
|
||||||
|
return (putnbr_b((t_lu)va_arg(*args, t_ui), DEC, 0, info));
|
||||||
|
}
|
||||||
|
if (str[info->i] == 'x')
|
||||||
|
return (putnbr_b((t_lu)va_arg(*args, t_ui), HEXLO, 0, info));
|
||||||
|
if (str[info->i] == 'X')
|
||||||
|
return (putnbr_b((t_lu)va_arg(*args, t_ui), HEXUP, 0, info));
|
||||||
|
if (str[info->i] == '%')
|
||||||
|
return (putstr(0, '%', CHAR, info));
|
||||||
|
if (str[info->i] == 'p')
|
||||||
|
return (putstr("0x", 0, CHAR, info) + putnbr_b(va_arg(*args, t_lu),
|
||||||
|
HEXLO, 16, 0));
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int printf_fd(int fd, const char *str, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
t_info info;
|
||||||
|
|
||||||
|
va_start(args, str);
|
||||||
|
info.i = 0;
|
||||||
|
info.counter = 0;
|
||||||
|
info.base = 16;
|
||||||
|
info.fd = fd;
|
||||||
|
while (str[info.i])
|
||||||
|
{
|
||||||
|
if (str[info.i] == '%')
|
||||||
|
{
|
||||||
|
info.i++;
|
||||||
|
info.counter += format(str, &info, &args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
info.counter += putstr(0, str[info.i], CHAR, &info);
|
||||||
|
info.i++;
|
||||||
|
}
|
||||||
|
va_end(args);
|
||||||
|
return (info.counter);
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
!_TAG_EXTRA_DESCRIPTION anonymous /Include tags for non-named objects like lambda/
|
||||||
|
!_TAG_EXTRA_DESCRIPTION fileScope /Include tags of file scope/
|
||||||
|
!_TAG_EXTRA_DESCRIPTION pseudo /Include pseudo tags/
|
||||||
|
!_TAG_EXTRA_DESCRIPTION subparser /Include tags generated by subparsers/
|
||||||
|
!_TAG_FIELD_DESCRIPTION epoch /the last modified time of the input file (only for F\/file kind tag)/
|
||||||
|
!_TAG_FIELD_DESCRIPTION file /File-restricted scoping/
|
||||||
|
!_TAG_FIELD_DESCRIPTION input /input file/
|
||||||
|
!_TAG_FIELD_DESCRIPTION name /tag name/
|
||||||
|
!_TAG_FIELD_DESCRIPTION pattern /pattern/
|
||||||
|
!_TAG_FIELD_DESCRIPTION typeref /Type and name of a variable or typedef/
|
||||||
|
!_TAG_FIELD_DESCRIPTION!C++ name /aliased names/
|
||||||
|
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
||||||
|
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C d,macro /macro definitions/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C e,enumerator /enumerators (values inside an enumeration)/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C f,function /function definitions/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C g,enum /enumeration names/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C h,header /included header files/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C m,member /struct, and union members/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C s,struct /structure names/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C t,typedef /typedefs/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C u,union /union names/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C v,variable /variable definitions/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ M,module /modules/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ P,partition /partitions/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ c,class /classes/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ d,macro /macro definitions/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ e,enumerator /enumerators (values inside an enumeration)/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ f,function /function definitions/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ g,enum /enumeration names/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ h,header /included header files/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ m,member /class, struct, and union members/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ n,namespace /namespaces/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ s,struct /structure names/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ t,typedef /typedefs/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ u,union /union names/
|
||||||
|
!_TAG_KIND_DESCRIPTION!C++ v,variable /variable definitions/
|
||||||
|
!_TAG_KIND_DESCRIPTION!Make I,makefile /makefiles/
|
||||||
|
!_TAG_KIND_DESCRIPTION!Make m,macro /macros/
|
||||||
|
!_TAG_KIND_DESCRIPTION!Make t,target /targets/
|
||||||
|
!_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/
|
||||||
|
!_TAG_OUTPUT_FILESEP slash /slash or backslash/
|
||||||
|
!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/
|
||||||
|
!_TAG_OUTPUT_VERSION 0.0 /current.age/
|
||||||
|
!_TAG_PARSER_VERSION!C 1.1 /current.age/
|
||||||
|
!_TAG_PARSER_VERSION!C++ 1.1 /current.age/
|
||||||
|
!_TAG_PARSER_VERSION!Make 0.0 /current.age/
|
||||||
|
!_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/
|
||||||
|
!_TAG_PROC_CWD /home/null/Documents/better_ray_tracer/libft/ //
|
||||||
|
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
|
||||||
|
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
|
||||||
|
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
|
||||||
|
!_TAG_PROGRAM_VERSION 6.1.0 /653ca9204/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C!function foreigndecl /declared in foreign languages/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C!header local /local header/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C!header system /system header/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C!macro undef /undefined/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C!struct foreigndecl /declared in foreign languages/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C++!header exported /exported with "exported imported ..."/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C++!header imported /imported with "imported ..."/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C++!header local /local header/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C++!header system /system header/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C++!macro undef /undefined/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C++!module imported /imported with "imported ..."/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C++!module partOwner /used for specifying a partition/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!C++!partition imported /imported with "imported ..."/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!Make!makefile included /included/
|
||||||
|
!_TAG_ROLE_DESCRIPTION!Make!makefile optional /optionally included/
|
||||||
|
$(NAME) Makefile /^$(NAME): $(OBJS)$/;" t
|
||||||
|
%.o Makefile /^%.o: %.c$/;" t
|
||||||
|
AR Makefile /^AR = ar rcs$/;" m
|
||||||
|
BUFFER_SIZE get_next_line.h /^# define BUFFER_SIZE /;" d
|
||||||
|
CC Makefile /^CC = cc$/;" m
|
||||||
|
CFLAGS Makefile /^CFLAGS = -Wall -Wextra -Werror -g3$/;" m
|
||||||
|
CHAR libft.h /^# define CHAR /;" d
|
||||||
|
DEC libft.h /^# define DEC /;" d
|
||||||
|
GET_NEXT_LINE_H get_next_line.h /^# define GET_NEXT_LINE_H$/;" d
|
||||||
|
HEXLO libft.h /^# define HEXLO /;" d
|
||||||
|
HEXUP libft.h /^# define HEXUP /;" d
|
||||||
|
LIBFT_H libft.h /^# define LIBFT_H$/;" d
|
||||||
|
NAME Makefile /^NAME = libft.a$/;" m
|
||||||
|
OBJS Makefile /^OBJS = ft_calloc.o ft_isascii.o ft_itoa.o ft_memcpy.o ft_putchar_fd.o ft_putstr_fd.o f/;" m
|
||||||
|
RM Makefile /^RM = rm -f$/;" m
|
||||||
|
SRCS Makefile /^SRCS = ft_calloc.c ft_isascii.c ft_itoa.c ft_memcpy.c ft_putchar_fd.c ft_putstr_fd.c f/;" m
|
||||||
|
STR libft.h /^# define STR /;" d
|
||||||
|
all Makefile /^all: $(NAME)$/;" t
|
||||||
|
base libft.h /^ int base;$/;" m struct:s_info typeref:typename:int
|
||||||
|
clean Makefile /^clean:$/;" t
|
||||||
|
count_word ft_split.c /^static size_t count_word(char *str, char c)$/;" f typeref:typename:size_t file:
|
||||||
|
counter libft.h /^ size_t counter;$/;" m struct:s_info typeref:typename:size_t
|
||||||
|
divisor ft_split.c /^static char **divisor(char *str1, char c, char **array, size_t len)$/;" f typeref:typename:char ** file:
|
||||||
|
fclean Makefile /^fclean: clean$/;" t
|
||||||
|
fd libft.h /^ int fd;$/;" m struct:s_info typeref:typename:int
|
||||||
|
format printf_fd.c /^static int format(const char *str, t_info *info, va_list *args)$/;" f typeref:typename:int file:
|
||||||
|
free_array ft_split.c /^static void free_array(char **s1)$/;" f typeref:typename:void file:
|
||||||
|
ft_atoi ft_atoi.c /^int ft_atoi(const char *text)$/;" f typeref:typename:int
|
||||||
|
ft_bzero ft_bzero.c /^void ft_bzero(void *s, size_t n)$/;" f typeref:typename:void
|
||||||
|
ft_calloc ft_calloc.c /^void *ft_calloc(size_t n, size_t size)$/;" f typeref:typename:void *
|
||||||
|
ft_fsign ft_atoi.c /^static int ft_fsign(char c)$/;" f typeref:typename:int file:
|
||||||
|
ft_is_space ft_is_space.c /^int ft_is_space(char c)$/;" f typeref:typename:int
|
||||||
|
ft_isalnum ft_isalnum.c /^int ft_isalnum(int c)$/;" f typeref:typename:int
|
||||||
|
ft_isalpha ft_isalpha.c /^int ft_isalpha(int c)$/;" f typeref:typename:int
|
||||||
|
ft_isascii ft_isascii.c /^int ft_isascii(int c)$/;" f typeref:typename:int
|
||||||
|
ft_isdigit ft_isdigit.c /^int ft_isdigit(int c)$/;" f typeref:typename:int
|
||||||
|
ft_isprint ft_isprint.c /^int ft_isprint(int c)$/;" f typeref:typename:int
|
||||||
|
ft_isspace ft_atoi.c /^static int ft_isspace(char c)$/;" f typeref:typename:int file:
|
||||||
|
ft_itoa ft_itoa.c /^char *ft_itoa(int n)$/;" f typeref:typename:char *
|
||||||
|
ft_memchr ft_memchr.c /^void *ft_memchr(const void *s, int c, size_t n)$/;" f typeref:typename:void *
|
||||||
|
ft_memcmp ft_memcmp.c /^int ft_memcmp(const void *s1, const void *s2, size_t n)$/;" f typeref:typename:int
|
||||||
|
ft_memcpy ft_memcpy.c /^void *ft_memcpy(void *dest, const void *src, size_t n)$/;" f typeref:typename:void *
|
||||||
|
ft_memmove ft_memmove.c /^void *ft_memmove(void *dest, const void *src, size_t n)$/;" f typeref:typename:void *
|
||||||
|
ft_memset ft_memset.c /^void *ft_memset(void *s, int c, size_t n)$/;" f typeref:typename:void *
|
||||||
|
ft_n_digit ft_itoa.c /^static int ft_n_digit(int n)$/;" f typeref:typename:int file:
|
||||||
|
ft_n_digit ft_putnbr_fd.c /^static int ft_n_digit(int n)$/;" f typeref:typename:int file:
|
||||||
|
ft_pow ft_itoa.c /^static int ft_pow(int n)$/;" f typeref:typename:int file:
|
||||||
|
ft_pow ft_putnbr_fd.c /^static int ft_pow(int n)$/;" f typeref:typename:int file:
|
||||||
|
ft_putchar_fd ft_putchar_fd.c /^void ft_putchar_fd(char c, int fd)$/;" f typeref:typename:void
|
||||||
|
ft_putendl_fd ft_putendl_fd.c /^void ft_putendl_fd(char *s, int fd)$/;" f typeref:typename:void
|
||||||
|
ft_putnbr_fd ft_putnbr_fd.c /^void ft_putnbr_fd(int n, int fd)$/;" f typeref:typename:void
|
||||||
|
ft_putstr_fd ft_putstr_fd.c /^void ft_putstr_fd(char *s, int fd)$/;" f typeref:typename:void
|
||||||
|
ft_set_digit ft_itoa.c /^static void ft_set_digit(long nbr_digit, long index, char *nbr, long n)$/;" f typeref:typename:void file:
|
||||||
|
ft_set_digit ft_putnbr_fd.c /^static void ft_set_digit(long nbr_digit, long n, int fd)$/;" f typeref:typename:void file:
|
||||||
|
ft_set_number ft_itoa.c /^static void ft_set_number(char *tab)$/;" f typeref:typename:void file:
|
||||||
|
ft_set_number ft_putnbr_fd.c /^static void ft_set_number(char *tab)$/;" f typeref:typename:void file:
|
||||||
|
ft_split ft_split.c /^char **ft_split(char const *s, char c)$/;" f typeref:typename:char **
|
||||||
|
ft_strchr ft_strchr.c /^char *ft_strchr(const char *s, int c)$/;" f typeref:typename:char *
|
||||||
|
ft_strdup ft_strdup.c /^char *ft_strdup(const char *s1)$/;" f typeref:typename:char *
|
||||||
|
ft_striteri ft_striteri.c /^void ft_striteri(char *s, void (*f)(unsigned int, char *))$/;" f typeref:typename:void
|
||||||
|
ft_strjoin ft_strjoin.c /^char *ft_strjoin(char const *s1, char const *s2)$/;" f typeref:typename:char *
|
||||||
|
ft_strlcat ft_strlcat.c /^size_t ft_strlcat(char *dest, const char *src, size_t size)$/;" f typeref:typename:size_t
|
||||||
|
ft_strlcpy ft_strlcpy.c /^size_t ft_strlcpy(char *dest, const char *src, size_t size)$/;" f typeref:typename:size_t
|
||||||
|
ft_strlen ft_strlen.c /^size_t ft_strlen(const char *c)$/;" f typeref:typename:size_t
|
||||||
|
ft_strmapi ft_strmapi.c /^char *ft_strmapi(char const *s, char (*f)(unsigned int, char))$/;" f typeref:typename:char *
|
||||||
|
ft_strncmp ft_strncmp.c /^int ft_strncmp(const char *s1, const char *s2, size_t n)$/;" f typeref:typename:int
|
||||||
|
ft_strnstr ft_strnstr.c /^char *ft_strnstr(const char *big, const char *little, size_t len)$/;" f typeref:typename:char *
|
||||||
|
ft_strrchr ft_strrchr.c /^char *ft_strrchr(const char *s, int c)$/;" f typeref:typename:char *
|
||||||
|
ft_strtod ft_strtod.c /^double ft_strtod(char *string)$/;" f typeref:typename:double
|
||||||
|
ft_strtrim ft_strtrim.c /^char *ft_strtrim(char const *s1, char const *set)$/;" f typeref:typename:char *
|
||||||
|
ft_substr ft_substr.c /^char *ft_substr(char const *s, unsigned int start, size_t len)$/;" f typeref:typename:char *
|
||||||
|
ft_tolower ft_tolower.c /^int ft_tolower(int c)$/;" f typeref:typename:int
|
||||||
|
ft_toupper ft_toupper.c /^int ft_toupper(int c)$/;" f typeref:typename:int
|
||||||
|
get_next_line gnl.c /^char *get_next_line(int fd)$/;" f typeref:typename:char *
|
||||||
|
gnl_ft_getline gnl.c /^char *gnl_ft_getline(char *static_str)$/;" f typeref:typename:char *
|
||||||
|
gnl_ft_remove_bn gnl.c /^char *gnl_ft_remove_bn(char *static_str)$/;" f typeref:typename:char *
|
||||||
|
gnl_ft_strchr gnl_utils.c /^char *gnl_ft_strchr(char *s, int c)$/;" f typeref:typename:char *
|
||||||
|
gnl_ft_strjoin gnl_utils.c /^char *gnl_ft_strjoin(char *s1, char *s2)$/;" f typeref:typename:char *
|
||||||
|
gnl_ft_strlen gnl_utils.c /^size_t gnl_ft_strlen(char *s)$/;" f typeref:typename:size_t
|
||||||
|
gnl_read_fd gnl.c /^char *gnl_read_fd(int fd, char *str)$/;" f typeref:typename:char *
|
||||||
|
i libft.h /^ size_t i;$/;" m struct:s_info typeref:typename:size_t
|
||||||
|
len_word ft_split.c /^static size_t len_word(char *s, char c, size_t start)$/;" f typeref:typename:size_t file:
|
||||||
|
partie_entiere ft_strtod.c /^static int partie_entiere(double *entier, char *string, int i, double *sign)$/;" f typeref:typename:int file:
|
||||||
|
printf_fd printf_fd.c /^int printf_fd(int fd, const char *str, ...)$/;" f typeref:typename:int
|
||||||
|
putnbr_b printf_fd.c /^static int putnbr_b(t_lu n, char *str, int numdig, t_info *info)$/;" f typeref:typename:int file:
|
||||||
|
putstr printf_fd.c /^static int putstr(char *str, char c, int is_char, t_info *info)$/;" f typeref:typename:int file:
|
||||||
|
re Makefile /^re: fclean all$/;" t
|
||||||
|
s_info libft.h /^struct s_info$/;" s
|
||||||
|
t_info libft.h /^typedef struct s_info t_info;$/;" t typeref:struct:s_info
|
||||||
|
t_lu libft.h /^typedef unsigned long t_lu;$/;" t typeref:typename:unsigned long
|
||||||
|
t_ui libft.h /^typedef unsigned int t_ui;$/;" t typeref:typename:unsigned int
|
||||||
|
treat_int printf_fd.c /^static int treat_int(int n, char *str, int numdig, t_info *info)$/;" f typeref:typename:int file:
|
||||||
Reference in New Issue
Block a user