Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yabtaour
GitHub Repository: yabtaour/Minishell-42
Path: blob/main/execution/my_mess/echo_utils.c
1407 views
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* echo_utils.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: ssabbaji <[email protected]> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2022/09/15 14:02:01 by ssabbaji #+# #+# */
9
/* Updated: 2022/09/30 16:56:01 by ssabbaji ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "../../minishell.h"
14
15
char *join_cmd(char **argv, int argc, int i)
16
{
17
char *args;
18
19
args = NULL;
20
while (i < argc)
21
{
22
args = ft_strjoin(args, argv[i++]);
23
args = ft_strjoin(args, " ");
24
}
25
return (args);
26
}
27
28
int check_valid(char *cmd)
29
{
30
int i;
31
32
i = 1;
33
if (cmd[0] == '-')
34
{
35
if (!cmd[1])
36
return (0);
37
while (cmd[i])
38
{
39
if (cmd[i] != 'n')
40
return (0);
41
i++;
42
}
43
}
44
else
45
return (0);
46
return (1);
47
}
48
49