Browse Source

little adds

master
narnaud 3 years ago
parent
commit
840a269351
  1. 21
      Makefile
  2. 0
      conv/ft_itox.c
  3. 0
      conv/ft_utoa.c
  4. 0
      dlist/ft_add.c
  5. 0
      dlist/ft_n.c
  6. 4
      dlist/ft_to_arr.c
  7. 0
      i_slist/ft_first.c
  8. 0
      i_slist/ft_free.c
  9. 0
      i_slist/ft_is_in.c
  10. 0
      is/ft_islower.c
  11. 26
      is/ft_isnumber.c
  12. 4
      is/ft_isspace.c
  13. 0
      is/ft_isupper.c
  14. 7
      libft.h
  15. 0
      mem/ft_free_split.c
  16. 0
      nbr/ft_croissant.c
  17. 0
      nbr/ft_decroissant.c
  18. 21
      nbr/ft_max.c
  19. 21
      nbr/ft_min.c
  20. 0
      nbr/ft_nbrlen.c
  21. 27
      str/ft_join_with.c
  22. 0
      str/ft_rev.c
  23. 2
      str/ft_split.c

21
Makefile

@ -1,12 +1,12 @@
NAME = libft.a
SRCS = is/ft_isalpha.c is/ft_isdigit.c is/ft_isascii.c is/ft_isprint.c \
is/ft_isalnum.c
is/ft_isalnum.c is/ft_isspace.c is/ft_isnumber.c
SRCS += str/ft_len.c str/ft_lcpy.c str/ft_lcat.c str/ft_chr.c \
str/ft_rchr.c str/ft_ncmp.c str/ft_nstr.c str/ft_dup.c \
str/ft_sub.c str/ft_join.c str/ft_trim.c str/ft_split.c \
str/ft_rev.c str/ft_mapi.c str/ft_iteri.c
str/ft_rev.c str/ft_mapi.c str/ft_iteri.c str/ft_join_with.c
SRCS += conv/ft_toupper.c conv/ft_tolower.c conv/ft_atoi.c conv/ft_itoa.c \
conv/ft_itox.c conv/ft_utoa.c
@ -17,7 +17,8 @@ SRCS += mem/ft_bzero.c mem/ft_memset.c mem/ft_memchr.c mem/ft_memcpy.c \
SRCS += put/ft_putchar_fd.c put/ft_putnbr_fd.c put/ft_putendl_fd.c \
put/ft_putstr_fd.c
SRCS += nbr/ft_nbrlen.c nbr/ft_croissant.c nbr/ft_decroissant.c
SRCS += nbr/ft_nbrlen.c nbr/ft_croissant.c nbr/ft_decroissant.c nbr/ft_max.c \
nbr/ft_min.c
SRCS += slist/ft_size.c slist/ft_new.c slist/ft_last.c \
slist/ft_add_back.c slist/ft_add_front.c slist/ft_delone.c \
@ -36,19 +37,23 @@ RM = rm -rf
CFLAGS = -Wall -Wextra -Werror
.c.o:
${CC} ${CFLAGS} -c $< -o ${<:.c=.o}
@${CC} ${CFLAGS} -c $< -o ${<:.c=.o}
all : $(NAME)
$(NAME): $(OBJS)
${AR} ${NAME} ${OBJS}
@echo "Making libft."
@${AR} ${NAME} ${OBJS}
@echo "Done."
clean:
${RM} ${OBJS}
${RM} ${OBJS_BONUS}
@echo "Cleaning libft."
@${RM} ${OBJS}
@${RM} ${OBJS_BONUS}
@echo "Done."
fclean: clean
${RM} ${NAME}
@${RM} ${NAME}
re: fclean all

0
conv/ft_itox.c

0
conv/ft_utoa.c

0
dlist/ft_add.c

0
dlist/ft_n.c

4
dlist/ft_to_arr.c

@ -33,9 +33,9 @@ char **ft_dlst_to_arr(t_dlist *ptr)
while (count--)
{
ret[count] = last->content;
tmp = last;
tmp = last->previous;
free(last);
last = tmp->previous;
last = tmp;
}
return (ret);
}

0
i_slist/ft_first.c

0
i_slist/ft_free.c

0
i_slist/ft_is_in.c

0
is/ft_islower.c

26
is/ft_isnumber.c

@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isnumber.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud@student.42nice.fr <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/18 16:18:15 by narnaud@stude #+# #+# */
/* Updated: 2022/05/18 16:21:52 by narnaud@stude ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
int ft_isnumber(char *str)
{
if (*str == '-' || *str == '+')
str++;
while (*str)
{
if (!ft_isdigit(*str))
return (0);
str++;
}
return (1);
}

4
is/ft_isspace.c

@ -6,13 +6,13 @@
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/24 10:05:51 by narnaud #+# #+# */
/* Updated: 2022/03/24 10:06:15 by narnaud ### ########.fr */
/* Updated: 2022/05/03 09:47:28 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
int ft_isspace(char c)
int ft_isspace(int c)
{
if (c > 8 && c < 14)
return (1);

0
is/ft_isupper.c

7
libft.h

@ -6,7 +6,7 @@
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/19 14:42:45 by narnaud #+# #+# */
/* Updated: 2022/03/25 13:31:43 by narnaud ### ########.fr */
/* Updated: 2022/05/18 16:25:27 by narnaud@stude ### ########.fr */
/* */
/* ************************************************************************** */
@ -44,6 +44,8 @@ int ft_isascii(int ch);
int ft_isdigit(int ch);
int ft_isprint(int ch);
int ft_isalnum(int ch);
int ft_isspace(int ch);
int ft_isnumber(char *str);
void *ft_memchr(const void *b, int c, size_t n);
int ft_memcmp(const void *s1, const void *s2, size_t n);
void *ft_memcpy(void *dst, const void *src, size_t n);
@ -55,6 +57,8 @@ size_t ft_ulen(unsigned int nbr);
size_t ft_longbaselen(long nbr, size_t base);
int ft_croissant(int a, int b);
int ft_decroissant(int a, int b);
int ft_max(int a, int b);
int ft_min(int a, int b);
void *ft_memset(void *b, int c, size_t len);
char *ft_strchr(const char *s, int c);
@ -71,6 +75,7 @@ int ft_tolower(int c);
int ft_toupper(int c);
char *ft_substr(char const *s, unsigned int start, size_t len);
char *ft_strjoin(const char *s1, const char *s2);
char *ft_strjoin_with(char *s1, char *s2, char *inter);
char *ft_strtrim(char const *s1, char const *set);
char **ft_split(char const *str, char ch);
char *ft_itoa(int n);

0
mem/ft_free_split.c

0
nbr/ft_croissant.c

0
nbr/ft_decroissant.c

21
nbr/ft_max.c

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_max.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud@student.42nice.fr <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/07 22:56:56 by narnaud@stude #+# #+# */
/* Updated: 2022/05/07 22:57:21 by narnaud@stude ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
int ft_max(int a, int b)
{
if (a > b)
return (a);
else
return (b);
}

21
nbr/ft_min.c

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_min.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud@student.42nice.fr <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/07 22:56:56 by narnaud@stude #+# #+# */
/* Updated: 2022/05/09 08:58:50 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
int ft_min(int a, int b)
{
if (a < b)
return (a);
else
return (b);
}

0
nbr/ft_nbrlen.c

27
str/ft_join_with.c

@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_join_with.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/17 09:44:59 by narnaud #+# #+# */
/* Updated: 2022/05/17 09:56:37 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
char *ft_strjoin_with(char *s1, char *s2, char *inter)
{
int path_length;
char *ret;
path_length = ft_strlen(s1) + ft_strlen(s2) + ft_strlen(inter) + 1;
ret = ft_calloc(path_length, sizeof(char));
ft_memcpy(ret, s1, ft_strlen(s1));
ft_memcpy(ret + ft_strlen(s1), inter, ft_strlen(inter));
ft_memcpy(ret + ft_strlen(s1) + ft_strlen(inter), \
s2, ft_strlen(s2));
return (ret);
}

0
str/ft_rev.c

2
str/ft_split.c

@ -38,5 +38,5 @@ char **ft_split(const char *str, char c)
word[j++] = str[i];
}
words = ft_dlst_add(words, word);
return ((char **)ft_dlst_to_arr(words));
return (ft_dlst_to_arr(words));
}

Loading…
Cancel
Save