-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildin_cd_utils.c
42 lines (38 loc) · 1.31 KB
/
buildin_cd_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* buildin_cd_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ggiannit <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/14 09:50:22 by ggiannit #+# #+# */
/* Updated: 2023/04/14 09:50:24 by ggiannit ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void ft_abs_path(t_mish *meta)
{
ft_free((void **) &(meta->olddir));
meta->olddir = ft_strdup(meta->curdir);
ft_free((void **) &(meta->curdir));
meta->curdir = ft_strdup(meta->home_path);
}
int ft_find_path(char *str, int *k)
{
int j;
int find_slash;
j = 0;
find_slash = 0;
while (str[j])
{
if (str[j] == '/')
{
*k = j;
find_slash++;
}
j++;
}
if (find_slash == 1)
return (-42);
return (0);
}