-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipex_helper.c
39 lines (34 loc) · 1.3 KB
/
pipex_helper.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipex_helper.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: melkholy <melkholy@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/10 15:15:48 by melkholy #+# #+# */
/* Updated: 2022/09/10 15:17:07 by melkholy ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
void ft_single_q(char *str, char **cmd_path)
{
int count;
count = 0;
while (cmd_path[count])
count ++;
free(cmd_path[count - 1]);
cmd_path[count - 1] = str;
}
char *ft_found_q(char *cmd, char **str)
{
char *tmp;
*str = ft_strdup(ft_strchr(cmd, 39));
cmd = ft_strtrim(cmd, *str);
tmp = ft_strjoin(cmd, " 42");
free(cmd);
cmd = tmp;
tmp = ft_strtrim(*str, "'");
free(*str);
*str = tmp;
return (cmd);
}