-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils3.c
52 lines (45 loc) · 1.52 KB
/
utils3.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils3.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wilhelmfermey <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/31 13:38:29 by wilhelmfermey #+# #+# */
/* Updated: 2022/05/31 13:50:33 by wilhelmfermey ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int ft_strcmp(char *s1, char *s2)
{
int i;
if (!s1 || !s2)
return (1);
i = 0;
while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0')
i++;
return (s1[i] - s2[i]);
}
void update_exit_code(char *str)
{
t_list *tmp;
tmp = *g_envp;
((char *)(tmp->content))[0] = 0;
((char *)(tmp->content))[1] = 0;
((char *)(tmp->content))[2] = 0;
free(tmp->content);
tmp->content = ft_strjoin("?=", str);
}
void add_list(t_seg **seg)
{
t_seg *temp;
t_seg *new;
temp = *seg;
while (temp->next != NULL)
temp = temp->next;
new = malloc(sizeof(t_seg));
if (!new)
printf("error malloc\n");
new->next = NULL;
temp->next = new;
}