added test function
This commit is contained in:
39
Makefile
Normal file
39
Makefile
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#******************************************************************************#
|
||||||
|
# #
|
||||||
|
# ::: :::::::: #
|
||||||
|
# Makefile :+: :+: :+: #
|
||||||
|
# +:+ +:+ +:+ #
|
||||||
|
# By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ #
|
||||||
|
# +#+#+#+#+#+ +#+ #
|
||||||
|
# Created: 2019/02/09 15:12:22 by tmaze #+# #+# #
|
||||||
|
# Updated: 2019/02/09 15:45:01 by tmaze ### ########.fr #
|
||||||
|
# #
|
||||||
|
#******************************************************************************#
|
||||||
|
|
||||||
|
CC := gcc
|
||||||
|
CCFLAGS := -Wall -Werror -Wextra -g
|
||||||
|
CCSTD :=
|
||||||
|
|
||||||
|
NAME := libftprintf.a
|
||||||
|
|
||||||
|
SRCS := ft_printf.c pf_getflags.c
|
||||||
|
OBJS_DIR := objs
|
||||||
|
OBJS := $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
.PHONY = all clean fclean re
|
||||||
|
|
||||||
|
all: $(NAME)
|
||||||
|
|
||||||
|
$(NAME): $(OBJS)
|
||||||
|
ar rcs $(NAME) $(OBJS)
|
||||||
|
|
||||||
|
%.o: srcs/%.c includes/libftprintf.h
|
||||||
|
$(CC) $(CCFLAGS) $(CCSTD) $(INCLS) -c $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(OBJS)
|
||||||
|
|
||||||
|
fclean: clean
|
||||||
|
rm -f $(NAME)
|
||||||
|
|
||||||
|
re: fclean all
|
@@ -6,7 +6,7 @@
|
|||||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/02/07 13:03:44 by tmaze #+# #+# */
|
/* Created: 2019/02/07 13:03:44 by tmaze #+# #+# */
|
||||||
/* Updated: 2019/02/07 17:03:50 by tmaze ### ########.fr */
|
/* Updated: 2019/02/09 14:38:22 by tmaze ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -41,6 +41,7 @@ typedef struct s_flags
|
|||||||
char size;
|
char size;
|
||||||
} t_flags;
|
} t_flags;
|
||||||
|
|
||||||
|
void pf_putflags(t_flags *flags);
|
||||||
size_t pf_getflags(const char *format, t_flags *flags);
|
size_t pf_getflags(const char *format, t_flags *flags);
|
||||||
|
|
||||||
int pf_convc(t_flags *flags, va_list *ap);
|
int pf_convc(t_flags *flags, va_list *ap);
|
||||||
|
18
srcs/ft_putchar.c
Normal file
18
srcs/ft_putchar.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putchar.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2018/04/07 19:03:57 by tmaze #+# #+# */
|
||||||
|
/* Updated: 2018/04/07 23:02:29 by tmaze ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void ft_putchar(char c)
|
||||||
|
{
|
||||||
|
write(1, &c, 1);
|
||||||
|
}
|
20
srcs/ft_putendl.c
Normal file
20
srcs/ft_putendl.c
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putendl.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2018/04/07 22:37:44 by tmaze #+# #+# */
|
||||||
|
/* Updated: 2019/01/13 17:44:21 by tmaze ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void ft_putendl(char const *s)
|
||||||
|
{
|
||||||
|
if (s != NULL)
|
||||||
|
ft_putstr(s);
|
||||||
|
ft_putchar('\n');
|
||||||
|
}
|
19
srcs/ft_putstr.c
Normal file
19
srcs/ft_putstr.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ft_putstr.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2018/04/07 19:13:17 by tmaze #+# #+# */
|
||||||
|
/* Updated: 2018/04/12 11:23:29 by tmaze ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "libft.h"
|
||||||
|
|
||||||
|
void ft_putstr(char const *s)
|
||||||
|
{
|
||||||
|
if (s != NULL)
|
||||||
|
write(1, s, ft_strlen(s));
|
||||||
|
}
|
@@ -6,7 +6,7 @@
|
|||||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/02/07 14:14:38 by tmaze #+# #+# */
|
/* Created: 2019/02/07 14:14:38 by tmaze #+# #+# */
|
||||||
/* Updated: 2019/02/07 17:11:26 by tmaze ### ########.fr */
|
/* Updated: 2019/02/09 14:36:30 by tmaze ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -23,6 +23,26 @@ void pf_initflags(t_flags *flags)
|
|||||||
flags->size = '\0';
|
flags->size = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pf_putflags(t_flags *flags)
|
||||||
|
{
|
||||||
|
ft_putendl("--- putflags ---");
|
||||||
|
ft_putstr("convtype->");
|
||||||
|
ft_putnbr(flags->convtype);
|
||||||
|
ft_putstr("/nminus->");
|
||||||
|
ft_putchar(flags->minus);
|
||||||
|
ft_putstr("/nsign->");
|
||||||
|
ft_putchar(flags->sign);
|
||||||
|
ft_putstr("/nhash->");
|
||||||
|
ft_putchar(flags->hash);
|
||||||
|
ft_putstr("/nwidth->");
|
||||||
|
ft_putnbr(flags->width);
|
||||||
|
ft_putstr("/nprecision->");
|
||||||
|
ft_putnbr(flags->precision);
|
||||||
|
ft_putstr("/nsize->");
|
||||||
|
ft_putchar(flags->size);
|
||||||
|
ft_putchar("/n");
|
||||||
|
}
|
||||||
|
|
||||||
size_t pf_getflags(const char *format, t_flags *flags)
|
size_t pf_getflags(const char *format, t_flags *flags)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
Reference in New Issue
Block a user