-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
38 lines (35 loc) · 709 Bytes
/
main.c
File metadata and controls
38 lines (35 loc) · 709 Bytes
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
#include "holberton.h"
/**
* main - entry point for application
* @ac: argument count
* @av: argument vector
* Return: 0 on success
*/
int main(int ac, char **av)
{
_unix ssh;
(void)ac;
signal(SIGINT, sigintHandler);
configInit(&ssh);
ssh.shellName = av[0];
shell(&ssh);
return (0);
}
/**
* configInit - initialize member values for _unix struct
* @ssh: input ssh
* Return: ssh with initialized members
*/
_unix *configInit(_unix *ssh)
{
ssh->env = generateLinkedList(environ);
ssh->envList = NULL;
ssh->args = NULL;
ssh->buffer = NULL;
ssh->path = _getenv("PATH", environ);
ssh->fullPath = NULL;
ssh->lineCounter = 0;
ssh->shellName = NULL;
ssh->errorStatus = 0;
return (ssh);
}