-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.c
51 lines (46 loc) · 1.42 KB
/
init.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ctreton <ctreton@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/01/05 10:14:44 by ctreton #+# #+# */
/* Updated: 2014/01/10 20:09:35 by ctreton ### ########.fr */
/* */
/* ************************************************************************** */
#include "select.h"
int init_fd(int fd)
{
fd = open(ttyname(fd), O_RDWR | O_NONBLOCK);
return (fd);
}
void create_arg(int ac, char **av)
{
int i;
t_elem *e;
t_elem *prev;
i = 1;
while (i < ac)
{
e = (t_elem *)malloc(sizeof(t_elem));
e->value = ft_strdup(av[i]);
e->sel = 0;
prev = g_all.c.end;
if (g_all.c.start)
prev->next = e;
else
g_all.c.start = e;
e->prev = prev;
e->next = NULL;
g_all.c.end = e;
i++;
}
set_coor();
}
void init_glob(void)
{
g_all.c.start = NULL;
g_all.c.end = NULL;
g_all.c.cur = NULL;
}