42-archive/42sh/includes/builtin_read.h
2017-03-22 16:50:40 +01:00

59 lines
2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* builtin_read.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/20 15:02:39 by jhalford #+# #+# */
/* Updated: 2017/03/22 16:12:31 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef BUILTIN_READ_H
# define BUILTIN_READ_H
# define BT_READ_LA (1 << 0)
# define BT_READ_LD (1 << 1)
# define BT_READ_LE (1 << 2)
# define BT_READ_LI (1 << 3)
# define BT_READ_LN (1 << 4)
# define BT_READ_UN (1 << 5)
# define BT_READ_LP (1 << 6)
# define BT_READ_LR (1 << 7)
# define BT_READ_LS (1 << 8)
# define BT_READ_LT (1 << 9)
# define BT_READ_LU (1 << 10)
# define BT_READ_INTER (1 << 11)
typedef struct s_read t_read;
typedef struct s_readopt t_readopt;
struct s_read
{
t_flag opts;
char **names;
char delim;
int nchars;
char *prompt;
int timeout;
int fd;
char *input;
};
int builtin_read(const char *path, char *const av[],
char *const envp[]);
int bt_read_init(t_read *data, char **av);
struct termios bt_read_term(int init);
int bt_read_terminit(t_read *data);
int bt_read_exit(t_read *data);
int bt_read_getdelim(char ***argv, t_read *data);
int bt_read_getnchars(char ***argv, t_read *data);
int bt_read_getprompt(char ***argv, t_read *data);
int bt_read_gettimeout(char ***argv, t_read *data);
int bt_read_getfd(char ***argv, t_read *data);
#endif