kekw
This commit is contained in:
@ -6,19 +6,19 @@
|
||||
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
|
||||
# Updated: 2023/01/04 20:00:03 by cchauvet ### ########.fr #
|
||||
# Updated: 2023/01/05 19:00:54 by cchauvet ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
CC = clang
|
||||
|
||||
SRCS = ft_strcmp.c ft_strfjoin.c ft_strmerger.c
|
||||
SRCS = draw.c main.c map.c shape.c xpm.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
NAME = extra.a
|
||||
|
||||
CFLAGS = -Wall -Werror -Wextra
|
||||
CFLAGS = -Wall -Werror -Wextra -g
|
||||
|
||||
%.o: %.c extra.h
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/01/04 14:03:10 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/04 19:59:10 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 18:59:25 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,5 +18,6 @@
|
||||
|
||||
char *ft_strfjoin(char *s1, char *s2);
|
||||
char *ft_strmerger(size_t arg_len, ...);
|
||||
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size);
|
||||
int ft_strcmp(char *s1, char *s2);
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/01/04 19:20:47 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/04 19:22:20 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 13:20:20 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,7 +14,10 @@
|
||||
|
||||
int ft_strcmp(char *s1, char *s2)
|
||||
{
|
||||
while (*s1 == *s2 && *s1 != '\0')
|
||||
s1++;
|
||||
return (*s1 - *s2);
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (s1[i] == s2[i] && s1[i] != '\0')
|
||||
i++;
|
||||
return (s1[i] - s2[i]);
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
33
libftx/extra/ft_tabrealloc.c
Normal file
33
libftx/extra/ft_tabrealloc.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_tabrealloc.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/01/05 18:58:48 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/05 18:58:59 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "extra.h"
|
||||
|
||||
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size)
|
||||
{
|
||||
char **new;
|
||||
size_t i;
|
||||
|
||||
new = malloc(new_size * sizeof(char *));
|
||||
if (new == NULL)
|
||||
return (NULL);
|
||||
i = 0;
|
||||
while (i < current_size)
|
||||
{
|
||||
new[i] = tab[i];
|
||||
i++;
|
||||
}
|
||||
free(tab);
|
||||
return (new);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
# By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2022/12/14 15:49:18 by cchauvet #+# #+# #
|
||||
# Updated: 2022/12/14 16:08:19 by cchauvet ### ########.fr #
|
||||
# Updated: 2023/01/05 17:44:06 by cchauvet ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -16,7 +16,7 @@ OBJS = ${SRCS:.c=.o}
|
||||
|
||||
NAME = get_next_line.a
|
||||
|
||||
CFLAGS = -Wall -Werror -Wextra
|
||||
CFLAGS = -Wall -Werror -Wextra -g
|
||||
|
||||
CC = clang
|
||||
|
||||
|
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/26 00:52:47 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/11/14 15:37:48 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 13:07:10 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -36,7 +36,7 @@ char *ft_getline(int fd)
|
||||
|
||||
stash = NULL;
|
||||
buf = NULL;
|
||||
while (ft_strchr(stash, '\n') == -1)
|
||||
while (ft_strchri(stash, '\n') == -1)
|
||||
{
|
||||
buf = ft_getstash(fd);
|
||||
if (buf == NULL)
|
||||
@ -54,7 +54,7 @@ char *ft_getreturn(char *str)
|
||||
|
||||
if (str == NULL)
|
||||
return (NULL);
|
||||
i = ft_strchr(str, '\n') + 1;
|
||||
i = ft_strchri(str, '\n') + 1;
|
||||
if (i == 0)
|
||||
i = ft_strlen(str);
|
||||
return (ft_strndup(str, i));
|
||||
@ -67,7 +67,7 @@ char *ft_getextra(char *str)
|
||||
|
||||
if (str == NULL)
|
||||
return (NULL);
|
||||
i = ft_strchr(str, '\n') + 1;
|
||||
i = ft_strchri(str, '\n') + 1;
|
||||
if (i == 0)
|
||||
return (NULL);
|
||||
j = ft_strlen(str + i);
|
||||
@ -81,7 +81,7 @@ char *get_next_line(int fd)
|
||||
char *buf2;
|
||||
|
||||
buf2 = stash;
|
||||
if (ft_strchr(stash, '\n') == -1)
|
||||
if (ft_strchri(stash, '\n') == -1)
|
||||
{
|
||||
buf1 = ft_getline(fd);
|
||||
buf2 = ft_strfjoin(stash, buf1);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/11/14 15:38:06 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/04 20:05:54 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 13:06:19 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,12 +17,11 @@
|
||||
# ifndef BUFFER_SIZE
|
||||
# define BUFFER_SIZE 42
|
||||
# endif
|
||||
|
||||
# include "../libft/libft.h"
|
||||
void *ft_calloc(size_t nmemb, size_t size);
|
||||
void *ft_realloc(void *ptr, size_t size);
|
||||
char *ft_strfjoin(char *dst, char *src);
|
||||
char *ft_strndup(char *src, size_t n);
|
||||
size_t ft_strlen(char *str);
|
||||
ssize_t ft_strchr(char *str, char c);
|
||||
ssize_t ft_strchri(char *str, char c);
|
||||
char *get_next_line(int fd);
|
||||
#endif
|
||||
|
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/26 00:55:44 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/11/14 15:39:50 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 13:06:37 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -31,18 +31,6 @@ void *ft_calloc(size_t nmemb, size_t size)
|
||||
return ((void *) tab);
|
||||
}
|
||||
|
||||
size_t ft_strlen(char *str)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (str == NULL)
|
||||
return (0);
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
i++;
|
||||
return (i);
|
||||
}
|
||||
|
||||
char *ft_strfjoin(char *s1, char *s2)
|
||||
{
|
||||
ssize_t i;
|
||||
@ -91,7 +79,7 @@ char *ft_strndup(char *src, size_t n)
|
||||
return (out);
|
||||
}
|
||||
|
||||
ssize_t ft_strchr(char *str, char c)
|
||||
ssize_t ft_strchri(char *str, char c)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
|
||||
# Updated: 2023/01/04 15:35:42 by cchauvet ### ########.fr #
|
||||
# Updated: 2023/01/05 17:44:37 by cchauvet ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -63,7 +63,7 @@ BOBJS = $(BSRCS:.c=.o)
|
||||
|
||||
NAME = libft.a
|
||||
|
||||
CFLAGS = -Wall -Werror -Wextra
|
||||
CFLAGS = -Wall -Werror -Wextra -g
|
||||
|
||||
%.o: %.c libft.h
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,13 +6,13 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/29 22:23:35 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/09/29 22:24:53 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 18:54:54 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void ft_putchar_fd(char c, int fd)
|
||||
void ft_putchar_fd(int fd, char c)
|
||||
{
|
||||
write(fd, &c, 1);
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,15 +6,18 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/26 12:03:59 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/09/27 09:02:11 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 17:46:12 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include <stddef.h>
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
size_t ft_strlen(const char *s)
|
||||
{
|
||||
size_t length;
|
||||
|
||||
if (s == NULL)
|
||||
return (0);
|
||||
length = 0;
|
||||
while (s[length])
|
||||
length++;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/26 14:47:54 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/04 15:20:30 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 18:55:10 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -46,7 +46,7 @@ char **ft_split(char const *s, char c);
|
||||
char *ft_itoa(int n);
|
||||
char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
|
||||
void ft_striteri(char *s, void (*f)(unsigned int, char*));
|
||||
void ft_putchar_fd(char c, int fd);
|
||||
void ft_putchar_fd(int fd, char c);
|
||||
void ft_putstr_fd(char *s, int fd);
|
||||
void ft_putendl_fd(char *s, int fd);
|
||||
void ft_putnbr_fd(int n, int fd);
|
||||
|
BIN
libftx/libftx.a
BIN
libftx/libftx.a
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/26 14:47:54 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/04 20:07:06 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 18:59:40 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
int ft_printf(const char *format, ...);
|
||||
char *get_next_line(int fd);
|
||||
|
||||
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size);
|
||||
char *ft_strfjoin(char *s1, char *s2);
|
||||
char *ft_strmerger(size_t arg_len, ...);
|
||||
int ft_strcmp(char *s1, char *s2);
|
||||
@ -54,10 +55,10 @@ char **ft_split(char const *s, char c);
|
||||
char *ft_itoa(int n);
|
||||
char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
|
||||
void ft_striteri(char *s, void (*f)(unsigned int, char*));
|
||||
void ft_putchar_fd(char c, int fd);
|
||||
void ft_putstr_fd(char *s, int fd);
|
||||
void ft_putendl_fd(char *s, int fd);
|
||||
void ft_putnbr_fd(int n, int fd);
|
||||
void ft_putchar_fd(int fd, char c);
|
||||
void ft_putstr_fd(int fd, char *s);
|
||||
void ft_putendl_fd(int fd, char *s);
|
||||
void ft_putnbr_fd(int fd, int n);
|
||||
|
||||
typedef struct s_list
|
||||
{
|
||||
|
@ -6,22 +6,22 @@
|
||||
# By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2022/09/27 08:39:27 by cchauvet #+# #+# #
|
||||
# Updated: 2023/01/04 15:36:08 by cchauvet ### ########.fr #
|
||||
# Updated: 2023/01/05 18:25:05 by cchauvet ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
CC = clang
|
||||
|
||||
SRCS = ft_dprintul_base.c ft_isdigit.c ft_dprintul.c ft_dprintx.c ft_dprintflag.c ft_skipflag.c ft_vdprintf.c ft_dprintl_base.c ft_dprintX.c ft_dprintptr.c ft_strlen.c ft_putstr_fd.c ft_dprintarg.c ft_printf.c ft_putchar_fd.c ft_isarg.c
|
||||
SRCS = ft_dprintarg.c ft_dprintflag.c ft_dprintl_base.c ft_dprintptr.c ft_dprintstrtab.c ft_dprintul_base.c ft_dprintul.c ft_dprintx.c ft_dprintX.c ft_isarg.c ft_isdigit.c ft_printf.c ft_putchar_fd.c ft_putstr_fd.c ft_skipflag.c ft_strlen.c ft_vdprintf.c
|
||||
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
|
||||
NAME = ft_printf.a
|
||||
|
||||
CFLAG = -Wall -Werror -Wextra
|
||||
CFLAG = -Wall -Werror -Wextra -g
|
||||
|
||||
%.o: %.c
|
||||
${CC} ${CFLAGS} -c -o $@ $<
|
||||
${CC} ${CFLAG} -c -o $@ $<
|
||||
|
||||
all: ${NAME}
|
||||
|
||||
|
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/23 18:08:31 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/10/23 18:54:41 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 17:37:12 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -24,6 +24,8 @@ int ft_dprintarg(int fd, int arg, va_list args)
|
||||
return (ft_dprintul(fd, va_arg(args, unsigned int)));
|
||||
if (arg == 'c')
|
||||
return (ft_putchar_fd(fd, va_arg(args, int)));
|
||||
if (arg == 'S')
|
||||
return (ft_dprintstrtab(fd, va_arg(args, char **)));
|
||||
if (arg == 's')
|
||||
return (ft_putstr_fd(fd, va_arg(args, char *)));
|
||||
if (arg == '%')
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
29
libftx/printf/ft_dprintstrtab.c
Normal file
29
libftx/printf/ft_dprintstrtab.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_dprintstrtab.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/01/05 17:26:55 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/01/05 18:52:56 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
|
||||
int ft_dprintstrtab(int fd, char **tab)
|
||||
{
|
||||
size_t index;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
index = 0;
|
||||
while (tab[index] != NULL)
|
||||
{
|
||||
i += ft_putstr_fd(fd, tab[index]) + 1;
|
||||
ft_putchar_fd(fd, '\n');
|
||||
index++;
|
||||
}
|
||||
return (i);
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/11 22:37:41 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/10/12 16:09:22 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 18:26:24 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,7 +18,7 @@ int ft_isarg(int c)
|
||||
|
||||
if (c == '\0')
|
||||
return (1);
|
||||
flags = "cspdiuxX%";
|
||||
flags = "cspdiuxX%S";
|
||||
while (*flags)
|
||||
{
|
||||
if (*flags == c)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/09/26 14:47:54 by cchauvet #+# #+# */
|
||||
/* Updated: 2022/11/07 19:41:50 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/01/05 17:36:39 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -29,6 +29,7 @@ int ft_dprintx(int fd, unsigned int n);
|
||||
int ft_dprint_upperx(int fd, unsigned int n);
|
||||
int ft_dprintflag(int fd, const char *flag, va_list va);
|
||||
int ft_dprintarg(int fd, int c, va_list va);
|
||||
int ft_dprintstrtab(int fd, char **tab);
|
||||
|
||||
int ft_printf(const char *format, ...);
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user