merge of the work

This commit is contained in:
wescande 2017-03-07 21:01:33 +01:00
commit 8c2103fa1b
158 changed files with 358 additions and 325 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 17:21:56 by jhalford #+# #+# */ /* Created: 2016/12/13 17:21:56 by jhalford #+# #+# */
/* Updated: 2017/02/27 20:28:37 by ariard ### ########.fr */ /* Updated: 2017/03/07 17:29:38 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -32,4 +32,6 @@ int builtin_bg(const char *path, char *const av[], char *const envp[]);
int builtin_history(const char *path, char *const av[], char *const envp[]); int builtin_history(const char *path, char *const av[], char *const envp[]);
int builtin_hash(const char *path, char *const av[], char *const envp[]); int builtin_hash(const char *path, char *const av[], char *const envp[]);
extern t_stof g_builtins[];
#endif #endif

View file

@ -6,13 +6,15 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */ /* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
/* Updated: 2017/03/07 20:50:23 by wescande ### ########.fr */ /* Updated: 2017/03/07 20:55:11 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef EXEC_H #ifndef EXEC_H
# define EXEC_H # define EXEC_H
# include <sys/stat.h>
# define PIPE_READ 0 # define PIPE_READ 0
# define PIPE_WRITE 1 # define PIPE_WRITE 1
@ -42,11 +44,6 @@
# define EXEC_IS_IF_BRANCH(j) (j & EXEC_IF_BRANCH) # define EXEC_IS_IF_BRANCH(j) (j & EXEC_IF_BRANCH)
# define EXEC_IS_CASE_BRANCH(j) (j & EXEC_CASE_BRANCH) # define EXEC_IS_CASE_BRANCH(j) (j & EXEC_CASE_BRANCH)
# include "../libft/includes/libft.h"
# include "types.h"
# include "job_control.h"
# include "minishell.h"
struct s_data_cmd struct s_data_cmd
{ {
char **av; char **av;
@ -146,7 +143,7 @@ int exec_else(t_btree **ast);
int exec_var(t_btree **ast); int exec_var(t_btree **ast);
//int exec_for(t_btree **ast); //int exec_for(t_btree **ast);
//int exec_case(t_btree **ast); //int exec_case(t_btree **ast);
//int exec_case_branch(t_btree **ast); int exec_case_branch(t_btree **ast);
int exec_math(t_btree **ast); int exec_math(t_btree **ast);
int launch_process(t_process *p); int launch_process(t_process *p);
@ -178,6 +175,7 @@ void redir_free(void *data, size_t content_size);
char **token_to_argv(t_ld *ld, int do_match); char **token_to_argv(t_ld *ld, int do_match);
# include <sys/stat.h>
int add_new_job(t_job *job); int add_new_job(t_job *job);
int error_badidentifier(char *name); int error_badidentifier(char *name);

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */ /* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */
/* Updated: 2017/02/21 19:51:19 by jhalford ### ########.fr */ /* Updated: 2017/03/07 18:36:00 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -54,20 +54,6 @@
# define TOUCHE_F5 892427035 # define TOUCHE_F5 892427035
# define TOUCHE_F6 925981467 # define TOUCHE_F6 925981467
/* # define PROMPT_QUOTES "quote> " */
/* # define PROMPT_DQUOTES "dquote> " */
/* # define PROMPT_BQUOTES "bquote> " */
/* # define PROMPT_ACCOLADE "cursh> " */
/* # define PROMPT_BRACKET "subsh> " */
/* # define PROMPT_BSLASH "> " */
/* # define SIZE_PROMPT_QUOTES 7 */
/* # define SIZE_PROMPT_DQUOTES 8 */
/* # define SIZE_PROMPT_BQUOTES 8 */
/* # define SIZE_PROMPT_ACCOLADE 7 */
/* # define SIZE_PROMPT_BRACKET 7 */
/* # define SIZE_PROMPT_BSLASH 2 */
# define IS_QUOTES (1 << 0) # define IS_QUOTES (1 << 0)
# define IS_BQUOTES (1 << 1) # define IS_BQUOTES (1 << 1)
# define IS_DQUOTES (1 << 2) # define IS_DQUOTES (1 << 2)

View file

@ -6,15 +6,13 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/04 16:31:18 by wescande #+# #+# */ /* Created: 2017/01/04 16:31:18 by wescande #+# #+# */
/* Updated: 2017/03/07 20:40:28 by wescande ### ########.fr */ /* Updated: 2017/03/07 20:57:04 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef GLOB_H #ifndef GLOB_H
# define GLOB_H # define GLOB_H
# include "minishell.h"
# define CH(x) ((char **)(x)->content) # define CH(x) ((char **)(x)->content)
# define UCH(x) ((unsigned char **)(x)->content) # define UCH(x) ((unsigned char **)(x)->content)
# define SCH(x) ((char **)(x).content) # define SCH(x) ((char **)(x).content)
@ -107,32 +105,5 @@ char **ft_strsplit_spe(const char *str,
const unsigned char *esc, char c); const unsigned char *esc, char c);
unsigned char **ft_strsplit_esc(const char *str, unsigned char **ft_strsplit_esc(const char *str,
const unsigned char *esc, char c); const unsigned char *esc, char c);
/*
** LIST D:
*/
void ft_ld_new(t_ld **alst, void *content);
t_ld *ft_ld_front(t_ld *ld);
void ft_ld_pushfront(t_ld **alst, void *content);
void ft_ld_pushback(t_ld **alst, void *content);
size_t ft_ld_size(t_ld *ld);
void ft_ld_del(t_ld **ld, void (*del)());
void ft_ld_clear(t_ld **ld, void (*del)());
void ft_ld_reverse(t_ld **lst);
t_ld *ft_ld_back(t_ld *ld);
t_ld *ft_ld_swap(t_ld *l_cur);
char **ft_ld_to_tab(t_ld *ld);
t_ld *ft_ld_order(t_ld *ld, int (*f)(), void (*del)());
t_ld *ft_ld_copy(t_ld *src, void *(*f)(void *elem));
/*
** str:
*/
char *ft_strjoinf(char *str, char *str2, int mode);
char *ft_strsubf(char *s, unsigned int start,
size_t len, short int mode);
void ft_tabdel(char ***mytab);
int ft_tablen(char **mytab);
void *ft_memrealloc(void *ptr, size_t old_s, size_t new_s);
#endif #endif

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */ /* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */
/* Updated: 2017/03/07 14:27:40 by jhalford ### ########.fr */ /* Updated: 2017/03/07 18:38:08 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,48 +14,24 @@
# define MINISHELL_H # define MINISHELL_H
# define SHELL_NAME "minishell" # define SHELL_NAME "minishell"
# include <dirent.h>
# include <sys/stat.h>
# include <signal.h>
# include <fcntl.h>
# include <errno.h>
# include "libft.h" # include "libft.h"
# include "types.h" # include "types.h"
# include "lexer.h" # include "lexer.h"
# include "parser.h" # include "parser.h"
# include "ft_readline.h" # include "ft_readline.h"
# include "job_control.h"
# include "exec.h" # include "exec.h"
# include "builtin.h" # include "builtin.h"
# include "job_control.h"
# include "glob.h" # include "glob.h"
# include "completion.h" # include "completion.h"
# include "hash.h" # include "hash.h"
# include <dirent.h>
# include <sys/stat.h>
# include <sys/types.h>
# include <signal.h>
# include <fcntl.h>
# include <errno.h>
# define SH_INTERACTIVE (1 << 0)
# define SH_OPTS_JOBC (1 << 1)
# define SH_OPTS_LC (1 << 2)
# define SH_MODE_INPUT (1 << 3)
# define SH_MODE_EXEC (1 << 4)
# define SH_MODE_MASK (SH_MODE_INPUT | SH_MODE_EXEC)
# define SH_HAS_JOBC(b) (b & SH_OPTS_JOBC)
# define SH_IS_INTERACTIVE(b) (b & SH_INTERACTIVE)
# define SH_NO_INTERACTIVE(b) !(b & SH_INTERACTIVE)
# define SH_MSG_NOJOBC "no job-control"
struct s_script
{
char *buffer;
int fd;
int size;
int lc;
};
typedef struct s_script t_script;
struct s_data struct s_data
{ {
char **env; char **env;
@ -70,8 +46,6 @@ struct s_data
t_list *lst_func; t_list *lst_func;
}; };
extern t_stof g_builtins[];
void shell_get_opts(int ac, char **av); void shell_get_opts(int ac, char **av);
char *shell_get_avdata(); char *shell_get_avdata();
void shell_init(int ac, char **av); void shell_init(int ac, char **av);

View file

@ -12,11 +12,8 @@
#ifndef PARSER_H #ifndef PARSER_H
# define PARSER_H # define PARSER_H
# include "minishell.h"
/* /*
* Parse POSIX grammar ** Parse POSIX grammar
*
*/ */
enum e_parstate enum e_parstate
@ -43,8 +40,6 @@ struct s_aggrematch
int erase_sym; int erase_sym;
}; };
extern t_aggrematch g_aggrematch[];
struct s_prodmatch struct s_prodmatch
{ {
t_type token; t_type token;
@ -52,22 +47,21 @@ struct s_prodmatch
t_sym new_sym; t_sym new_sym;
}; };
extern t_prodmatch g_prodmatch[];
struct s_stackmatch struct s_stackmatch
{ {
t_sym top; t_sym top;
t_sym under; t_sym under;
}; };
extern t_stackmatch g_stackmatch[];
struct s_errormatch struct s_errormatch
{ {
t_type token; t_type token;
char *error; char *error;
}; };
extern t_aggrematch g_aggrematch[];
extern t_prodmatch g_prodmatch[];
extern t_stackmatch g_stackmatch[];
extern t_errormatch g_errormatch[]; extern t_errormatch g_errormatch[];
void parser_init(t_parser *parser); void parser_init(t_parser *parser);

View file

@ -6,44 +6,72 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */ /* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
/* Updated: 2017/03/07 15:08:17 by jhalford ### ########.fr */ /* Updated: 2017/03/07 20:57:19 by wescande ### ########.fr */
/* Updated: 2017/03/07 18:35:11 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef TYPES_H #ifndef TYPES_H
# define TYPES_H # define TYPES_H
typedef struct s_data t_data; # include <sys/types.h>
# define SH_INTERACTIVE (1 << 0)
# define SH_OPTS_JOBC (1 << 1)
# define SH_OPTS_LC (1 << 2)
# define SH_MODE_INPUT (1 << 3)
# define SH_MODE_EXEC (1 << 4)
# define SH_MODE_MASK (SH_MODE_INPUT | SH_MODE_EXEC)
# define SH_HAS_JOBC(b) (b & SH_OPTS_JOBC)
# define SH_IS_INTERACTIVE(b) (b & SH_INTERACTIVE)
# define SH_NO_INTERACTIVE(b) !(b & SH_INTERACTIVE)
# define SH_MSG_NOJOBC "no job-control"
typedef long long t_type; typedef long long t_type;
typedef long long t_flag; typedef long long t_flag;
typedef struct s_data t_data;
typedef struct s_line t_line; typedef struct s_line t_line;
typedef struct s_comp t_comp; typedef struct s_comp t_comp;
typedef struct s_exec t_exec; typedef struct s_exec t_exec;
typedef struct s_jobc t_jobc; typedef struct s_jobc t_jobc;
typedef enum e_mode t_mode; typedef enum e_mode t_mode;
/*
** Execution types
*/
typedef struct s_lexer t_lexer; typedef struct s_lexer t_lexer;
typedef enum e_lexstate t_lexstate; typedef enum e_lexstate t_lexstate;
typedef struct s_token t_token; typedef struct s_token t_token;
typedef struct s_rvwords t_rvwords; typedef struct s_rvwords t_rvwords;
typedef struct s_ld t_ld; typedef struct s_ld t_ld;
/*
** Execution types
*/
typedef int t_condition;
typedef struct s_job t_job;
typedef struct s_process t_process;
typedef int (t_execf)(const char *path,
char *const argv[],
char *const envp[]);
/*
** Parser types
*/
typedef struct s_astnode t_astnode; typedef struct s_astnode t_astnode;
typedef struct s_redir t_redir; typedef struct s_redir t_redir;
typedef struct s_cmd t_cmd; typedef struct s_cmd t_cmd;
typedef union u_astdata t_astdata; typedef union u_astdata t_astdata;
typedef union u_word t_word; typedef union u_word t_word;
typedef int t_condition;
typedef struct s_job t_job;
typedef struct s_execmap t_execmap;
typedef struct s_redirmap t_redirmap;
typedef struct s_process t_process;
typedef int (t_execf)(const char *path, char *const argv[], char *const envp[]);
typedef int t_sym;
typedef struct s_parser t_parser; typedef struct s_parser t_parser;
typedef int t_sym;
typedef enum e_parstate t_parstate; typedef enum e_parstate t_parstate;
typedef struct s_aggrematch t_aggrematch; typedef struct s_aggrematch t_aggrematch;
typedef struct s_prodmatch t_prodmatch; typedef struct s_prodmatch t_prodmatch;
@ -169,4 +197,34 @@ enum e_sym
TERMINUS = 300, TERMINUS = 300,
}; };
/*
** LIST D:
*/
void ft_ld_new(t_ld **alst, void *content);
t_ld *ft_ld_front(t_ld *ld);
void ft_ld_pushfront(t_ld **alst, void *content);
void ft_ld_pushback(t_ld **alst, void *content);
size_t ft_ld_size(t_ld *ld);
void ft_ld_del(t_ld **ld, void (*del)());
void ft_ld_clear(t_ld **ld, void (*del)());
void ft_ld_reverse(t_ld **lst);
t_ld *ft_ld_back(t_ld *ld);
t_ld *ft_ld_swap(t_ld *l_cur);
char **ft_ld_to_tab(t_ld *ld);
t_ld *ft_ld_order(t_ld *ld, int (*f)(), void (*del)());
t_ld *ft_ld_copy(t_ld *src, void *(*f)(void *elem));
/*
** str:
*/
char *ft_strjoinf(char *str, char *str2, int mode);
char *ft_strsubf(char *s, unsigned int start,
size_t len, short int mode);
void ft_tabdel(char ***mytab);
int ft_tablen(char **mytab);
void *ft_memrealloc(void *ptr, size_t old_s, size_t new_s);
#endif #endif

View file

@ -1 +0,0 @@

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "builtin_read.h" #include "minishell.h"
int bt_read_getdelim(t_read *data, char *arg) int bt_read_getdelim(t_read *data, char *arg)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "builtin_read.h" #include "minishell.h"
static t_readopt *bt_read_getopt(char letter) static t_readopt *bt_read_getopt(char letter)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "builtin.h" #include "minishell.h"
struct termios bt_read_term(int init) struct termios bt_read_term(int init)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "builtin.h" #include "minishell.h"
#define CDOPT_L (1 << 0) #define CDOPT_L (1 << 0)
#define CDOPT_P (1 << 1) #define CDOPT_P (1 << 1)

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "builtin.h" #include "minishell.h"
int builtin_echo(const char *path, char *const av[], char *const envp[]) int builtin_echo(const char *path, char *const av[], char *const envp[])
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "builtin_read.h" #include "minishell.h"
t_readopt g_readtab[] = t_readopt g_readtab[] =
{ {

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */ /* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */
/* Updated: 2017/03/07 15:17:32 by wescande ### ########.fr */ /* Updated: 2017/03/07 19:42:54 by ariard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Retrieve the path from the env and create a char ** from the PATH pattern. ** Retrieve the path from the env and create a char ** from the PATH pattern.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Clear the list from the memory ** Clear the list from the memory

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** If the parsing for local file fail. The function is called to check if the ** If the parsing for local file fail. The function is called to check if the

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Trim if there's many commands in a raw separed with a semi colon. ** Trim if there's many commands in a raw separed with a semi colon.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Start the parsing for the autocompletion. ** Start the parsing for the autocompletion.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Support: Return the size of a char**. ** Support: Return the size of a char**.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Update of the struct data. ** Update of the struct data.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Add the matching element to the list ** Add the matching element to the list

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Solve the tilde pattern in the path ** Solve the tilde pattern in the path

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Print the name with or without an underline and colored upon file type ** Print the name with or without an underline and colored upon file type

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Recreate a c->match value by adding the new key pressed to it. ** Recreate a c->match value by adding the new key pressed to it.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Get the max length from the list ** Get the max length from the list

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Clear the previous list from the screen and restore the same position. ** Clear the previous list from the screen and restore the same position.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "completion.h" #include "minishell.h"
/* /*
** Function to select the next item in the list if it has already been created ** Function to select the next item in the list if it has already been created

View file

@ -6,11 +6,11 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */ /* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */
/* Updated: 2017/03/05 18:05:43 by ariard ### ########.fr */ /* Updated: 2017/03/07 18:34:27 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
void read_redir(void *data) void read_redir(void *data)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int error_badidentifier(char *name) int error_badidentifier(char *name)
{ {

View file

@ -6,11 +6,11 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 16:01:30 by jhalford #+# #+# */ /* Created: 2016/12/10 16:01:30 by jhalford #+# #+# */
/* Updated: 2017/03/03 19:35:21 by jhalford ### ########.fr */ /* Updated: 2017/03/07 18:24:12 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_ampersand(t_btree **ast) int exec_ampersand(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_and_if(t_btree **ast) int exec_and_if(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_case_branch(t_btree **ast) int exec_case_branch(t_btree **ast)
{ {

View file

@ -6,11 +6,11 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */ /* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
/* Updated: 2017/03/07 16:43:48 by wescande ### ########.fr */ /* Updated: 2017/03/07 17:33:50 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
/* /*
int exec_cmd(t_btree **ast) int exec_cmd(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_default(t_btree **ast) int exec_default(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_elif(t_btree **ast) int exec_elif(t_btree **ast)
{ {

View file

@ -10,6 +10,6 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"

View file

@ -6,11 +6,11 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */ /* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
/* Updated: 2017/03/07 15:50:04 by wescande ### ########.fr */ /* Updated: 2017/03/07 17:34:51 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_leaf(t_btree **ast) int exec_leaf(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
static int get_math(char *stream, char **var, char **value, char **operator) static int get_math(char *stream, char **var, char **value, char **operator)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_or_if(t_btree **ast) int exec_or_if(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_pipe(t_btree **ast) int exec_pipe(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_semi(t_btree **ast) int exec_semi(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int exec_until(t_btree **ast) int exec_until(t_btree **ast)
{ {

View file

@ -6,11 +6,11 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 11:12:05 by ariard #+# #+# */ /* Created: 2017/03/07 11:12:05 by ariard #+# #+# */
/* Updated: 2017/03/07 14:40:30 by ariard ### ########.fr */ /* Updated: 2017/03/07 18:37:38 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
static int set_var(char *stream, char **var, char **value) static int set_var(char *stream, char **var, char **value)
{ {

View file

@ -6,11 +6,11 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */ /* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */
/* Updated: 2017/03/07 17:22:42 by wescande ### ########.fr */ /* Updated: 2017/03/07 20:54:28 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
t_itof g_execmap[] = t_itof g_execmap[] =
{ {
@ -30,7 +30,7 @@ t_itof g_execmap[] =
{TK_PAREN_OPEN, &exec_case_branch}, {TK_PAREN_OPEN, &exec_case_branch},
{TK_ASSIGNEMENT_WORD, &exec_var}, {TK_ASSIGNEMENT_WORD, &exec_var},
{MATH, &exec_math}, {MATH, &exec_math},
/* {TK_SUBSHELL, &exec_}, */ /* {TK_SUBSHELL, &exec_leaf}, */
{CMD, &exec_leaf}, {CMD, &exec_leaf},
{0, 0}, {0, 0},
}; };

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int launch_builtin(t_process *p) int launch_builtin(t_process *p)
{ {

View file

@ -6,11 +6,11 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 14:53:31 by jhalford #+# #+# */ /* Created: 2017/03/07 14:53:31 by jhalford #+# #+# */
/* Updated: 2017/03/07 17:08:16 by wescande ### ########.fr */ /* Updated: 2017/03/07 20:58:31 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int launch_file(t_process *p) int launch_file(t_process *p)
{ {

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */ /* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
/* Updated: 2017/03/07 19:02:40 by wescande ### ########.fr */ /* Updated: 2017/03/07 20:58:52 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,11 +6,11 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */ /* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 17:20:53 by wescande #+# #+# */ /* Created: 2017/03/07 17:20:53 by wescande #+# #+# */
/* Updated: 2017/03/07 17:30:16 by wescande ### ########.fr */ /* Updated: 2017/03/07 20:59:40 by wescande ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
/* /*
int exec_while(t_btree **ast) int exec_while(t_btree **ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
int mark_process_status(pid_t pid, int status) int mark_process_status(pid_t pid, int status)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
t_redirmap g_redirmap[] = t_redirmap g_redirmap[] =
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
void process_reset(t_process *p) void process_reset(t_process *p)
{ {

View file

@ -10,8 +10,8 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
#include "exec.h" #include "minishell.h"
int process_setgroup(t_process *p, pid_t pid) int process_setgroup(t_process *p, pid_t pid)
{ {

View file

@ -1,4 +1,4 @@
#include "exec.h" #include "minishell.h"
void process_setsig(void) void process_setsig(void)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
void redir_free(void *data, size_t content_size) void redir_free(void *data, size_t content_size)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int redirect_dgreat(t_redir *redir) int redirect_dgreat(t_redir *redir)
{ {

View file

@ -9,7 +9,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int redirect_dless(t_redir *redir) int redirect_dless(t_redir *redir)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int redirect_great(t_redir* redir) int redirect_great(t_redir* redir)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int redirect_greatand(t_redir *redir) int redirect_greatand(t_redir *redir)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int redirect_less(t_redir *redir) int redirect_less(t_redir *redir)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int redirect_lessand(t_redir *redir) int redirect_lessand(t_redir *redir)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int set_process(t_process *p, t_btree *ast) int set_process(t_process *p, t_btree *ast)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd) int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int set_process_if(t_process *p, t_btree *ast, t_cmd *cmd) int set_process_if(t_process *p, t_btree *ast, t_cmd *cmd)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
t_itof g_setprocessmap[] = t_itof g_setprocessmap[] =
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
int set_process_while(t_process *p, t_btree *ast, t_cmd *cmd) int set_process_while(t_process *p, t_btree *ast, t_cmd *cmd)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "exec.h" #include "minishell.h"
char **token_to_argv(t_ld *ld, int do_match) char **token_to_argv(t_ld *ld, int do_match)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
int is_directory(const char *path) int is_directory(const char *path)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
void esc_print(char *str, unsigned char *esc) void esc_print(char *str, unsigned char *esc)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
static void expand_all_bquote(t_bquote *me, char *content, static void expand_all_bquote(t_bquote *me, char *content,
char *ifs) char *ifs)

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
/* /*
** expand_brace return expansion of a string. ** expand_brace return expansion of a string.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
unsigned char *calc_expand_esc(const unsigned char *esc, unsigned char *calc_expand_esc(const unsigned char *esc,
int nb_start, int *nb_middle, int *nb_end) int nb_start, int *nb_middle, int *nb_end)

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
void do_expand_home(t_bquote *me, char *home) void do_expand_home(t_bquote *me, char *home)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
/* /*
** expand_var return value of $var in the string. ** expand_var return value of $var in the string.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
static int ft_strlen_c(const char *str, const char *fix, static int ft_strlen_c(const char *str, const char *fix,
const unsigned char *esc, char c) const unsigned char *esc, char c)

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
static int ft_strlen_c(const char *str, const char *fix, static int ft_strlen_c(const char *str, const char *fix,
const unsigned char *esc, char c) const unsigned char *esc, char c)

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
/* /*
** glob return expansion of a string. ** glob return expansion of a string.

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
int is_char_esc(const unsigned char *esc, int is_char_esc(const unsigned char *esc,
const char *ini_str, const char *str_pos) const char *ini_str, const char *str_pos)

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "glob.h" #include "minishell.h"
static int match_bracket_char(char **cmp, const char *pat, char c, int neg) static int match_bracket_char(char **cmp, const char *pat, char c, int neg)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
int builtin_bg(const char *path, char *const av[], char *const envp[]) int builtin_bg(const char *path, char *const av[], char *const envp[])
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
int builtin_fg(const char *path, char *const av[], char *const envp[]) int builtin_fg(const char *path, char *const av[], char *const envp[])
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
static int bt_jobs_parse(char **av, int *i) static int bt_jobs_parse(char **av, int *i)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
int do_job_notification(void) int do_job_notification(void)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
int job_addprocess(t_process *p) int job_addprocess(t_process *p)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_format(t_job *j, int opts) void job_format(t_job *j, int opts)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_format_head(t_job *j) void job_format_head(t_job *j)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_free(void *content, size_t content_size) void job_free(void *content, size_t content_size)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
t_list *job_getprocess(pid_t pid) t_list *job_getprocess(pid_t pid)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_getrank(int (*rank)[2]) void job_getrank(int (*rank)[2])
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
int job_is_completed(int id) int job_is_completed(int id)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
int job_is_stopped(int id) int job_is_stopped(int id)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_kill_all(void) void job_kill_all(void)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_notify_change(int id) void job_notify_change(int id)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_notify_new(t_job *job) void job_notify_new(t_job *job)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_remove(int id) void job_remove(int id)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_run(t_job *job, int foreground) void job_run(t_job *job, int foreground)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void job_update_status(void) void job_update_status(void)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
int job_wait(int id) int job_wait(int id)
{ {

View file

@ -10,7 +10,7 @@
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "job_control.h" #include "minishell.h"
void mark_job_as_running(t_job *j) void mark_job_as_running(t_job *j)
{ {

Some files were not shown because too many files have changed in this diff Show more