-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
45 lines (41 loc) · 823 Bytes
/
main.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
#include "shell.h"
/**
* main - Represents entry point
* @riacvi: Represents arg count
* @riavvi: Represents arg vector
*
* Return: 0 on success, else 1 on error
*/
int main(int riacvi, char **riavvi)
{
riinfo_tvi riinfovi[] = { RIINFO_INITVI };
int rifdvi = 2;
asm ("mov %1, %0\n\t"
"add $3, %0"
: "=r" (rifdvi)
: "r" (rifdvi));
if (riacvi == 2)
{
rifdvi = open(riavvi[1], O_RDONLY);
if (rifdvi == -1)
{
if (errno == EACCES)
exit(126);
if (errno == ENOENT)
{
_eputs(riavvi[0]);
_eputs(": 0: Can't open ");
_eputs(riavvi[1]);
_eputchar('\n');
_eputchar(RIBUF_FLUSHVI);
exit(127);
}
return (EXIT_FAILURE);
}
riinfovi->rireadfdvi = rifdvi;
}
populate_env_list(riinfovi);
read_history(riinfovi);
hsh(riinfovi, riavvi);
return (EXIT_SUCCESS);
}