-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf_omaj.c
More file actions
34 lines (31 loc) · 1.26 KB
/
ft_printf_omaj.c
File metadata and controls
34 lines (31 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_omaj.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mfrisby <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/07/11 13:12:58 by mfrisby #+# #+# */
/* Updated: 2017/07/11 13:13:00 by mfrisby ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
void ft_printf_omaj(t_env *e)
{
char *tmp;
unsigned long int octal;
tmp = NULL;
e->type = 'O';
octal = va_arg(e->pa, unsigned long int);
tmp = ft_utoa_base(octal, 8);
e->type = 'O';
if (ft_strcmp(tmp, "0") == 0)
{
if (e->precision == 0)
ft_printf_putflags(e, ft_strdup(""));
else
ft_printf_putflags(e, tmp);
return ;
}
ft_printf_putflags(e, tmp);
}