-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.c
More file actions
35 lines (32 loc) · 1.26 KB
/
utils.c
File metadata and controls
35 lines (32 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
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sanmetol <sanmetol@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/19 11:22:21 by sanmetol #+# #+# */
/* Updated: 2024/11/26 19:00:41 by sanmetol ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
void ft_putstr_fd(const char *s, int fd)
{
write(fd, s, ft_strlen(s));
}
int ft_strncmp(const char *s1, const char *s2, size_t n)
{
if (s1 == NULL || s2 == NULL)
return (0);
while ((*s1 || *s2) && n > 0)
{
if ((unsigned char)*s1 > (unsigned char)*s2)
return (1);
if ((unsigned char)*s1 < (unsigned char)*s2)
return (-1);
s1++;
s2++;
n--;
}
return (0);
}