-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putstr.c
36 lines (33 loc) · 1.21 KB
/
ft_putstr.c
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
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ehakam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/15 21:18:17 by ehakam #+# #+# */
/* Updated: 2019/12/15 21:18:24 by ehakam ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
long ft_putstr(char *s, long n, char lf)
{
long count;
int minus;
long i;
count = 0;
i = 0;
minus = 0;
count = n > -1 ? n : ft_strlen(s);
if (s != NULL)
{
if (ft_atoi(s) < 0 && ft_find("Ddi", lf))
{
i++;
minus = 1;
}
while (i < count && s[i])
write(1, &s[i++], 1);
}
return (i - minus);
}