-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelp.c
69 lines (61 loc) · 1.42 KB
/
help.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* help.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: youel-id <youel-id@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/20 03:13:59 by youel-id #+# #+# */
/* Updated: 2023/03/20 03:14:01 by youel-id ### ########.fr */
/* */
/* ************************************************************************** */
#include "minitalk.h"
void ft_bzero(void *s, size_t n)
{
size_t i;
char *b;
b = (char *)s;
i = 0;
while (i < n)
{
b[i] = '\0';
i++;
}
}
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i])
{
i++;
}
return (i);
}
int ft_putnbr(int n)
{
long int i;
int c;
c = 0;
i = (long int)n;
if (i < 0)
{
i *= -1;
c += ft_putchar('-');
}
if (i > 9)
{
c += ft_putnbr(i / 10);
c += ft_putnbr(i % 10);
}
if (i >= 0 && i <= 9)
{
c += ft_putchar(i + 48);
}
return (c);
}
int ft_putchar(int c)
{
write(1, &c, 1);
return (1);
}