-
Notifications
You must be signed in to change notification settings - Fork 1
/
tools2.c
68 lines (61 loc) · 1.96 KB
/
tools2.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tools2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gpetrov <gpetrov@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/01/10 17:28:19 by gpetrov #+# #+# */
/* Updated: 2014/01/12 20:49:51 by gpetrov ### ########.fr */
/* */
/* ************************************************************************** */
#include "header.h"
int ft_get_size(t_data *d)
{
if((d->col = tgetnum("co")) < 1)
return (-1);
if((d->li = tgetnum("li")) < 1)
return (-1);
return (1);
}
int tputs_putchar(int c)
{
write(isatty(STDOUT_FILENO), &c, 1);
return (1);
}
void make_header(t_data *d)
{
ft_put_center(d);
ft_putstr_fd(" .__ __ \n", FDD);
ft_put_center(d);
ft_putstr_fd(" ______ ____ | | ____ _____/ |_ \n", FDD);
ft_put_center(d);
ft_putstr_fd(" / ___// __ \\| | _/ __ \\_/ ___\\ __\\\n", FDD);
ft_put_center(d);
ft_putstr_fd(" \\___ \\\\ ___/| |_\\ ___/\\ \\___| | \n", FDD);
ft_put_center(d);
ft_putstr_fd("/____ >\\___ >____/\\___ >\\___ >__| \n", FDD);
ft_put_center(d);
ft_putstr_fd(" \\/ \\/ \\/ \\/ \n", FDD);
make_header_bot(d);
}
void make_header_bot(t_data *d)
{
int i;
i = 1;
while (i <= d->col)
{
ft_putchar_fd('=', FDD);
i++;
}
ft_putchar_fd('\n', FDD);
}
void ft_print_pos(t_data *d)
{
ft_putstr("col = ");
ft_putnbr(d->col);
ft_putchar('\n');
ft_putstr("li = ");
ft_putnbr(d->li);
ft_putchar('\n');
}