-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch_mode.c
67 lines (65 loc) · 1.07 KB
/
switch_mode.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "shell.h"
/**
* switch_mode - get any input with av and env from program
* @ac : arguments count
* @av : argument array
* @env : environment array
*
<<<<<<< HEAD
* Return : 0 if successful; 1 otherwise
*/
int switch_mode(int ac, char **av, char **env)
{
int i = 1, a, e;
=======
* Return: 0 if successful; 1 otherwise
*/
int switch_mode(int ac, char **av, char **env)
{
int i = 1, j = 0, a, e;
>>>>>>> nick
if (ac > 1)
{
a = stat_exec(av, i);
<<<<<<< HEAD
e = stat_exec(env, i);
=======
e = stat_exec(env, j);
>>>>>>> nick
if (e != EXIT_SUCCESS)
{
if (a == STAT_FAILURE)
{
perror("ARGS Stat Error");
}
else if (a == EXEC_FAILURE)
{
perror("ARGS Execution Error");
}
}
else
{
if (a == STAT_FAILURE)
{
perror("ARGS Stat Error");
}
else if (a == EXEC_FAILURE)
{
perror("ARGS Execution Error");
}
}
}
else
<<<<<<< HEAD
fetch_token();
=======
{
if (fetch_token() == EXIT_FAILURE)
{
perror("Fetch Token Error");
return (EXIT_FAILURE);
}
}
>>>>>>> nick
return (EXIT_SUCCESS);
}