summaryrefslogtreecommitdiffstats
path: root/src/c_init.h
blob: dae85136ff284787891f3421becd67b94e61c981 (plain)
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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   c_init.h                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:19:27 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:19:29 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#ifndef C_INIT_H
# define C_INIT_H

# include <libft.h>
# include <termios.h>
# include <sys/ioctl.h>

# include "s_struct.h"

# define UP_K  0x415b1b
# define DOWN_K 0x425b1b
# define RIGHT_K 0x435b1b
# define LEFT_K  0x445b1b
# define HOME_K 0x485b1b
# define END_K 0x465b1b
# define DEL_K 0x7f
# define RET_K 0x0d

# define CTRL_A 0x01
# define CTRL_B 0x02
# define CTRL_C 0x03
# define CTRL_D 0x04
# define CTRL_E 0x05
# define CTRL_F 0x06
# define CTRL_L 0x0c
# define CTRL_N 0x0e
# define CTRL_P 0x10

typedef struct		s_caps
{
	struct termios	tios;
	struct winsize	ws;
	unsigned int	cpos;
	unsigned int	lpos;
	unsigned int	nlines;
	unsigned short	psx;
	unsigned short	plen;
}					t_caps;

char				*c_set_ptr(t_bool reset, char key, t_msh *msh);
short				c_gnl(int fd, char **line, char psx, t_msh *msh);
short				c_set_term_raw(char mode);

#endif