-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_is.c
70 lines (63 loc) · 1.95 KB
/
ft_is.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
68
69
70
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gpetrov <gpetrov@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/01/10 17:13:16 by gpetrov #+# #+# */
/* Updated: 2014/01/12 20:04:17 by gpetrov ### ########.fr */
/* */
/* ************************************************************************** */
#include "header.h"
int is_us(t_list *list, t_data *d)
{
list->co = 1;
if (d->us == 1)
return (1);
return (0);
}
int is_select(t_list *list, t_data *d)
{
list->co = 1;
if (d->selected == 1)
return (1);
return (0);
}
void is_spc_1(t_list *list, t_data *d)
{
tputs(tgoto(tgetstr("cm", NULL), 0, 0), 1, tputs_putchar);
d->pos = (d->pos + 1) - d->pos_init;
tputs(tgetstr("cl", NULL), 1, tputs_putchar);
make_header(d);
print_multi_tab(list, d);
}
void is_spc_2(t_list *list, t_data *d)
{
tputs(tgetstr("do", NULL), 1, tputs_putchar);
d->pos += 1;
tputs(tgetstr("cl", NULL), 1, tputs_putchar);
make_header(d);
print_multi_tab(list, d);
}
int is_spc(char *buf, t_list *list, t_data *d)
{
int i;
i = d->pos_init;
if (buf[0] == 32 && buf[1] == 0 && buf[2] == 0)
{
ft_putnbr(d->pos_init);
tputs(tgetstr("cl", NULL), 1, tputs_putchar);
make_header(d);
print_list_if(list, d);
if (d->pos == d->pos_init)
is_spc_1(list, d);
else
is_spc_2(list, d);
while (i-- >= d->pos)
tputs(tgetstr("up", NULL), 1, tputs_putchar);
return (0);
}
else
return (-1);
}