-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibft_utils.c
59 lines (52 loc) · 1.35 KB
/
libft_utils.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* libft_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rjobert <rjobert@student.42barcelo> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/12 17:26:32 by rjobert #+# #+# */
/* Updated: 2023/07/12 17:57:19 by rjobert ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int ft_isdigit(int c)
{
if (c >= 48 && c <= 57)
return (1);
else
return (0);
}
int ft_putstr(char *s)
{
int size;
int i;
if (!s)
{
s = "(null)";
}
i = 0;
while (s[i])
{
if (ft_putchar(s[i]) == -1)
return (-1);
else
i++;
}
size = ft_strlen(s);
return (size);
}
int ft_putchar(int x)
{
if (write(1, &x, 1) == -1)
return (-1);
return (1);
}
size_t ft_strlen(const char *str)
{
size_t i;
i = 0;
while (str[i])
i++;
return (i);
}