Files
ft_printf/libftprintf/ft_printf.h

71 lines
2.3 KiB
C
Raw Normal View History

2022-04-13 08:01:46 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* libftprintf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/18 15:26:06 by gbaconni #+# #+# */
2022-04-29 15:18:54 +02:00
/* Updated: 2022/04/29 14:45:30 by gbaconni ### ########.fr */
2022-04-13 08:01:46 +02:00
/* */
/* ************************************************************************** */
#ifndef LIBFTPRINTF_H
# define LIBFTPRINTF_H
# include "libft/libft.h"
# include <stdlib.h>
# include <stdarg.h>
# include <unistd.h>
/* Constants */
# ifdef __APPLE__
# define NIL "0x0"
# else
# define NIL "(nil)"
# endif
# define SPECIFIERS "cspdiuxX%"
# define HEXA_LOWER "0123456789abcdef"
# define HEXA_UPPER "0123456789ABCDEF"
/* Helper */
int ft_eoflags(const char *s);
char *ft_strrev(char *s);
char *ft_ltoa_base(long n, char *base);
int ft_putchar(int c);
int ft_puts(const char *s);
char *ft_unescape(const char *str);
2022-04-13 08:01:46 +02:00
/* Mandatory */
int ft_printf(const char *format, ...);
int ft_vprintf(char const *format, va_list ap);
2022-04-29 15:18:54 +02:00
int ft_va_char(const char *format, va_list ap);
int ft_va_string(const char *format, va_list ap);
int ft_va_pointer(const char *format, va_list ap);
int ft_va_decimal(const char *format, va_list ap);
int ft_va_hexadecimal(const char *format, va_list ap);
int ft_va_percent(const char *format, va_list ap);
int ft_va_escape(const char *format, va_list ap);
int ft_va_other(const char *format, va_list ap);
2022-04-13 08:01:46 +02:00
/* Bonus */
2022-04-25 13:19:42 +02:00
enum {
F_HASH = 1 << 0,
F_ZERO = 1 << 1,
F_MINUS = 1 << 2,
F_SPACE = 1 << 3,
F_PLUS = 1 << 4
};
2022-04-29 15:18:54 +02:00
int ft_va_precision_bonus(const char *format, va_list ap);
int ft_va_flags_bonus(const char *format, va_list ap);
int ft_va_string_bonus(const char *format, va_list ap, char *s);
int ft_va_decimal_bonus(const char *format, va_list ap, char *s);
int ft_va_hexadecimal_bonus(const char *format, va_list ap, char *s);
2022-04-25 13:19:42 +02:00
2022-04-13 08:01:46 +02:00
#endif