signals and termios WIP
+ shell script placeholder + generics functions + valgrind add_history() supp + misc
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/03 19:14:46 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/13 16:09:32 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/10/26 14:53:32 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# include "libft.h"
|
||||
# include <fcntl.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/ioctl.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <errno.h>
|
||||
@@ -52,8 +53,8 @@
|
||||
** <fcntl.h>: open()
|
||||
** <unistd.h>: read(), write(), close(), fork(), getcwd(), chdir(),
|
||||
** stat(), lstat(), fstat(), execve(), dup(), dup2(), pipe(),
|
||||
** isatty(), ttyname(), ttyslot(), ioctl(),
|
||||
** tcsetattr(), tcgetattr()
|
||||
** isatty(), ttyname(), ttyslot(), tcsetattr(), tcgetattr()
|
||||
** <sys/ioctl.h>: ioctl()
|
||||
** <stdlib.h>: malloc(), free(), exit(), getenv()
|
||||
** <string.h>: strerror(), define NULL, define size_t
|
||||
** <errno.h>: define errno
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/24 19:20:09 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/10/30 14:16:25 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -15,9 +15,15 @@
|
||||
|
||||
// Init
|
||||
int init(t_all *c, char *envp[]);
|
||||
int set_signals_handling(struct sigaction *ori_signal_behaviour,
|
||||
struct sigaction *signal_behaviour);
|
||||
int set_terminal_attributes(struct termios *ori_termios,
|
||||
struct termios *interactive_termios,
|
||||
int *termios_changed);
|
||||
|
||||
// Shell loop
|
||||
// Shell modes
|
||||
void shell_loop(t_all *c);
|
||||
void shell_script(t_all *c);
|
||||
|
||||
// Lexer
|
||||
t_token *input_to_tokens(char *input);
|
||||
@@ -43,7 +49,8 @@ char *ft_strjoinfree_s2(const char *s1, char *s2);
|
||||
void ft_lstprint(t_list *lst, int fd);
|
||||
int ft_isinset_str(char *str, char *set);
|
||||
size_t ft_2d_arrlen(void *ptr); // Replace ft_arrlen()
|
||||
void *ft_dup_2d_arr(void *ptr);
|
||||
char **ft_dup_2d_char_arr(char **ptr);
|
||||
void *ft_resize_2d_arr(void *ptr, size_t add_nbr);
|
||||
t_list *ft_lstbeforelast(t_list *lst);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/24 19:18:28 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/10/30 13:31:07 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MINISHELL_STRUCTS_H
|
||||
# define MINISHELL_STRUCTS_H
|
||||
|
||||
struct s_all;
|
||||
struct s_all *g_all;
|
||||
|
||||
enum e_token_id
|
||||
{
|
||||
T_TOKEN = 0,
|
||||
@@ -31,7 +34,6 @@ typedef struct s_token
|
||||
enum e_token_id id;
|
||||
} t_token;
|
||||
|
||||
struct s_all;
|
||||
typedef int (*t_builtin_ptr)(int,char **,struct s_all *);
|
||||
|
||||
typedef struct s_cmd
|
||||
@@ -45,12 +47,17 @@ typedef struct s_cmd
|
||||
|
||||
typedef struct s_all
|
||||
{
|
||||
t_cmd **cmd_arr;
|
||||
char **envp;
|
||||
char *prompt_base;
|
||||
char *prompt;
|
||||
t_token *token_list;
|
||||
int last_exit_status;
|
||||
t_cmd **cmd_arr;
|
||||
char **envp;
|
||||
char *prompt_base;
|
||||
char *prompt;
|
||||
t_token *token_list;
|
||||
int last_exit_status;
|
||||
struct termios ori_termios;
|
||||
struct termios interactive_termios;
|
||||
int termios_changed;
|
||||
struct sigaction ori_signal_behaviour;
|
||||
struct sigaction signal_behaviour;
|
||||
} t_all;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user