aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-15 07:56:02 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-15 08:49:32 +0100
commit49ad59b0e773e92e93fb69ede889c781ca53e680 (patch)
tree5ad230ddcc2198555e2b56ca84945809c137285d /src
parent5c6d9b3ba3e4946b2a527d10109f0e82284e64c5 (diff)
downloadlibft-49ad59b0e773e92e93fb69ede889c781ca53e680.tar.gz
libft-49ad59b0e773e92e93fb69ede889c781ca53e680.tar.bz2
libft-49ad59b0e773e92e93fb69ede889c781ca53e680.zip
Move *.o -> src/, *.h -> include/ and *.o -> build
Diffstat (limited to 'src')
-rw-r--r--src/ft_asprintf.c24
-rw-r--r--src/ft_atoi.c43
-rw-r--r--src/ft_bzero.c18
-rw-r--r--src/ft_calloc.c23
-rw-r--r--src/ft_dprintf.c24
-rw-r--r--src/ft_isalnum.c18
-rw-r--r--src/ft_isalpha.c16
-rw-r--r--src/ft_isascii.c18
-rw-r--r--src/ft_isdigit.c16
-rw-r--r--src/ft_isprint.c16
-rw-r--r--src/ft_itoa.c39
-rw-r--r--src/ft_lstadd_back_bonus.c25
-rw-r--r--src/ft_lstadd_front_bonus.c21
-rw-r--r--src/ft_lstclear_bonus.c24
-rw-r--r--src/ft_lstdelone_bonus.c22
-rw-r--r--src/ft_lstiter_bonus.c24
-rw-r--r--src/ft_lstlast_bonus.c22
-rw-r--r--src/ft_lstmap_bonus.c48
-rw-r--r--src/ft_lstnew_bonus.c24
-rw-r--r--src/ft_lstpop_front_bonus.c26
-rw-r--r--src/ft_lstsize_bonus.c26
-rw-r--r--src/ft_memalloc.c18
-rw-r--r--src/ft_memccpy.c31
-rw-r--r--src/ft_memchr.c26
-rw-r--r--src/ft_memcmp.c30
-rw-r--r--src/ft_memcpy.c22
-rw-r--r--src/ft_memdel.c21
-rw-r--r--src/ft_memmove.c33
-rw-r--r--src/ft_memset.c31
-rw-r--r--src/ft_printf.c24
-rw-r--r--src/ft_printf/convert.c122
-rw-r--r--src/ft_printf/convert_char.c53
-rw-r--r--src/ft_printf/convert_hex.c34
-rw-r--r--src/ft_printf/convert_int.c40
-rw-r--r--src/ft_printf/convert_none.c25
-rw-r--r--src/ft_printf/convert_percent.c23
-rw-r--r--src/ft_printf/convert_ptr.c29
-rw-r--r--src/ft_printf/convert_str.c25
-rw-r--r--src/ft_printf/convert_uint.c34
-rw-r--r--src/ft_printf/convert_written.c28
-rw-r--r--src/ft_printf/extract.c98
-rw-r--r--src/ft_printf/ft_printf.c92
-rw-r--r--src/ft_printf/ft_vasprintf.h155
-rw-r--r--src/ft_printf/length_modifier.c39
-rw-r--r--src/ft_printf/list.c67
-rw-r--r--src/ft_printf/parse.c61
-rw-r--r--src/ft_printf/utils.c115
-rw-r--r--src/ft_putchar.c18
-rw-r--r--src/ft_putchar_fd.c20
-rw-r--r--src/ft_putendl.c18
-rw-r--r--src/ft_putendl_fd.c21
-rw-r--r--src/ft_putnbr.c18
-rw-r--r--src/ft_putnbr_fd.c30
-rw-r--r--src/ft_putstr.c18
-rw-r--r--src/ft_putstr_fd.c20
-rw-r--r--src/ft_snprintf.c24
-rw-r--r--src/ft_split.c73
-rw-r--r--src/ft_sprintf.c24
-rw-r--r--src/ft_strcat.c19
-rw-r--r--src/ft_strchr.c18
-rw-r--r--src/ft_strclr.c20
-rw-r--r--src/ft_strcmp.c18
-rw-r--r--src/ft_strcount.c24
-rw-r--r--src/ft_strcpy.c18
-rw-r--r--src/ft_strdel.c18
-rw-r--r--src/ft_strdup.c22
-rw-r--r--src/ft_strequ.c20
-rw-r--r--src/ft_striter.c21
-rw-r--r--src/ft_striteri.c27
-rw-r--r--src/ft_strjoin.c24
-rw-r--r--src/ft_strjoin_free.c32
-rw-r--r--src/ft_strjoin_free_snd.c26
-rw-r--r--src/ft_strlcat.c32
-rw-r--r--src/ft_strlcpy.c28
-rw-r--r--src/ft_strlen.c41
-rw-r--r--src/ft_strmap.c34
-rw-r--r--src/ft_strmapi.c34
-rw-r--r--src/ft_strncat.c29
-rw-r--r--src/ft_strncmp.c25
-rw-r--r--src/ft_strncpy.c24
-rw-r--r--src/ft_strndup.c22
-rw-r--r--src/ft_strnequ.c20
-rw-r--r--src/ft_strnew.c18
-rw-r--r--src/ft_strnstr.c29
-rw-r--r--src/ft_strrchr.c24
-rw-r--r--src/ft_strstr.c29
-rw-r--r--src/ft_strtrim.c31
-rw-r--r--src/ft_substr.c26
-rw-r--r--src/ft_tolower.c24
-rw-r--r--src/ft_toupper.c20
-rw-r--r--src/ft_vasprintf.c21
-rw-r--r--src/ft_vdprintf.c24
-rw-r--r--src/ft_vprintf.c18
-rw-r--r--src/ft_vsnprintf.c26
-rw-r--r--src/ft_vsprintf.c18
-rw-r--r--src/get_next_line/get_next_line.c115
96 files changed, 3096 insertions, 0 deletions
diff --git a/src/ft_asprintf.c b/src/ft_asprintf.c
new file mode 100644
index 0000000..5eb62d9
--- /dev/null
+++ b/src/ft_asprintf.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_asprintf.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/11/21 02:30:33 by cacharle #+# #+# */
+/* Updated: 2019/11/21 03:43:08 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int ft_asprintf(char **ret, const char *format, ...)
+{
+ int vret;
+ va_list ap;
+
+ va_start(ap, format);
+ vret = ft_vasprintf(ret, format, ap);
+ va_end(ap);
+ return (vret);
+}
diff --git a/src/ft_atoi.c b/src/ft_atoi.c
new file mode 100644
index 0000000..bfba860
--- /dev/null
+++ b/src/ft_atoi.c
@@ -0,0 +1,43 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_atoi.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 09:46:16 by cacharle #+# #+# */
+/* Updated: 2019/11/20 01:43:18 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+#define MIN_INT -2147483648
+#define MAX_INT 2147483647
+
+int ft_atoi(const char *str)
+{
+ unsigned int nb;
+ int i;
+ int is_negative;
+
+ while (*str == ' ' || *str == '\t' || *str == '\n'
+ || *str == '\v' || *str == '\f' || *str == '\r')
+ str++;
+ is_negative = 0;
+ if (*str == '-' || *str == '+')
+ if (*str++ == '-')
+ is_negative = 1;
+ i = 0;
+ nb = 0;
+ while (ft_isdigit(str[i]))
+ {
+ if (!is_negative && nb > (unsigned int)MAX_INT)
+ return (-1);
+ else if (nb > (unsigned int)MIN_INT)
+ return (0);
+ nb *= 10;
+ nb += str[i++] & 0x0F;
+ }
+ return ((int)(is_negative ? -nb : nb));
+}
diff --git a/src/ft_bzero.c b/src/ft_bzero.c
new file mode 100644
index 0000000..d179af0
--- /dev/null
+++ b/src/ft_bzero.c
@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_bzero.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 09:50:10 by cacharle #+# #+# */
+/* Updated: 2019/11/20 03:29:26 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void ft_bzero(void *s, size_t n)
+{
+ ft_memset(s, 0, n);
+}
diff --git a/src/ft_calloc.c b/src/ft_calloc.c
new file mode 100644
index 0000000..24501bf
--- /dev/null
+++ b/src/ft_calloc.c
@@ -0,0 +1,23 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_calloc.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 12:45:37 by cacharle #+# #+# */
+/* Updated: 2019/11/21 01:05:53 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void *ft_calloc(size_t count, size_t size)
+{
+ void *mem;
+
+ if ((mem = malloc(count * size)) == NULL)
+ return (NULL);
+ ft_bzero(mem, count * size);
+ return (mem);
+}
diff --git a/src/ft_dprintf.c b/src/ft_dprintf.c
new file mode 100644
index 0000000..8e60970
--- /dev/null
+++ b/src/ft_dprintf.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_dprintf.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/11/21 02:29:11 by cacharle #+# #+# */
+/* Updated: 2019/11/21 03:42:05 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int ft_dprintf(int fd, const char *format, ...)
+{
+ int ret;
+ va_list ap;
+
+ va_start(ap, format);
+ ret = ft_vdprintf(fd, format, ap);
+ va_end(ap);
+ return (ret);
+}
diff --git a/src/ft_isalnum.c b/src/ft_isalnum.c
new file mode 100644
index 0000000..1ee1e0f
--- /dev/null
+++ b/src/ft_isalnum.c
@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_isalnum.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 09:41:40 by cacharle #+# #+# */
+/* Updated: 2019/10/07 09:41:56 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+int ft_isalnum(int c)
+{
+ return (ft_isalpha(c) || ft_isdigit(c));
+}
diff --git a/src/ft_isalpha.c b/src/ft_isalpha.c
new file mode 100644
index 0000000..6f155b4
--- /dev/null
+++ b/src/ft_isalpha.c
@@ -0,0 +1,16 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_isalpha.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 09:54:52 by cacharle #+# #+# */
+/* Updated: 2019/10/20 13:01:13 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+int ft_isalpha(int c)
+{
+ return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
+}
diff --git a/src/ft_isascii.c b/src/ft_isascii.c
new file mode 100644
index 0000000..51dcd1c
--- /dev/null
+++ b/src/ft_isascii.c
@@ -0,0 +1,18 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_isascii.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 09:54:30 by cacharle #+# #+# */
+/* Updated: 2019/10/20 13:03:23 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#define MAX_CHAR ((1 << 7) - 1)
+
+int ft_isascii(int c)
+{
+ return (c >= 0 && c <= MAX_CHAR);
+}
diff --git a/src/ft_isdigit.c b/src/ft_isdigit.c
new file mode 100644
index 0000000..f8a5850
--- /dev/null
+++ b/src/ft_isdigit.c
@@ -0,0 +1,16 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_isdigit.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 10:41:20 by cacharle #+# #+# */
+/* Updated: 2019/10/07 10:41:25 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+int ft_isdigit(int c)
+{
+ return (c >= '0' && c <= '9');
+}
diff --git a/src/ft_isprint.c b/src/ft_isprint.c
new file mode 100644
index 0000000..c311709
--- /dev/null
+++ b/src/ft_isprint.c
@@ -0,0 +1,16 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_isprint.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/07 09:52:09 by cacharle #+# #+# */
+/* Updated: 2019/10/20 13:03:36 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+int ft_isprint(int c)
+{
+ return (c >= ' ' && c <= '~');
+}
diff --git a/src/ft_itoa.c b/src/ft_itoa.c
new file mode 100644
index 0000000..166e278
--- /dev/null
+++ b/src/ft_itoa.c