changed header layout
This commit is contained in:
parent
48dc3d7c70
commit
764c62cc45
159 changed files with 249 additions and 269 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 16:55:12 by wescande ### ########.fr */
|
/* Updated: 2017/03/07 18:35:39 by jhalford ### ########.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;
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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/03 20:39:05 by wescande ### ########.fr */
|
/* Updated: 2017/03/07 18:18:33 by jhalford ### ########.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)
|
||||||
|
|
@ -105,31 +103,4 @@ 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)());
|
|
||||||
|
|
||||||
/*
|
|
||||||
** 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
|
||||||
|
|
|
||||||
|
|
@ -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:23:42 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,6 +14,12 @@
|
||||||
# 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"
|
||||||
|
|
@ -26,36 +32,6 @@
|
||||||
# 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);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -6,44 +6,71 @@
|
||||||
/* 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 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 +196,33 @@ 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)());
|
||||||
|
|
||||||
|
/*
|
||||||
|
** 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
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4a36b1a5e650ada2f66034d13312367694a6481a
|
Subproject commit bc489f8664fdc24317c31b3069811f54b1178643
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
struct termios bt_read_term(int init)
|
struct termios bt_read_term(int init)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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[])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "builtin_read.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
t_readopt g_readtab[] =
|
t_readopt g_readtab[] =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Clear the list from the memory
|
** Clear the list from the memory
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Start the parsing for the autocompletion.
|
** Start the parsing for the autocompletion.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Support: Return the size of a char**.
|
** Support: Return the size of a char**.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Update of the struct data.
|
** Update of the struct data.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Add the matching element to the list
|
** Add the matching element to the list
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Solve the tilde pattern in the path
|
** Solve the tilde pattern in the path
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Get the max length from the list
|
** Get the max length from the list
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int error_badidentifier(char *name)
|
int error_badidentifier(char *name)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_and_if(t_btree **ast)
|
int exec_and_if(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_case(t_btree **ast)
|
int exec_case(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_case_branch(t_btree **ast)
|
int exec_case_branch(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_default(t_btree **ast)
|
int exec_default(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_elif(t_btree **ast)
|
int exec_elif(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_for(t_btree **ast)
|
int exec_for(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,6 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_if(t_btree **ast)
|
int exec_if(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_or_if(t_btree **ast)
|
int exec_or_if(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_pipe(t_btree **ast)
|
int exec_pipe(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_semi(t_btree **ast)
|
int exec_semi(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_until(t_btree **ast)
|
int exec_until(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/30 17:33:53 by ariard #+# #+# */
|
/* Created: 2017/01/30 17:33:53 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/07 16:41:50 by wescande ### ########.fr */
|
/* Updated: 2017/03/07 18:35:07 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int exec_while(t_btree **ast)
|
int exec_while(t_btree **ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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 16:20:18 by wescande ### ########.fr */
|
/* Updated: 2017/03/07 17:00:45 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
t_itof g_execmap[] =
|
t_itof g_execmap[] =
|
||||||
{
|
{
|
||||||
|
|
@ -22,7 +22,7 @@ t_itof g_execmap[] =
|
||||||
{TK_PIPE, &exec_pipe},
|
{TK_PIPE, &exec_pipe},
|
||||||
{TK_WHILE, &exec_leaf},
|
{TK_WHILE, &exec_leaf},
|
||||||
{TK_IF, &exec_leaf},
|
{TK_IF, &exec_leaf},
|
||||||
{TK_ELIF, &exec_leaf},
|
{TK_ELIF, &exec_elif},
|
||||||
{TK_ELSE, &exec_leaf},
|
{TK_ELSE, &exec_leaf},
|
||||||
{TK_UNTIL, &exec_leaf},
|
{TK_UNTIL, &exec_leaf},
|
||||||
{TK_FOR, &exec_leaf},
|
{TK_FOR, &exec_leaf},
|
||||||
|
|
@ -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},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int launch_builtin(t_process *p)
|
int launch_builtin(t_process *p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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 16:49:31 by wescande ### ########.fr */
|
/* Updated: 2017/03/07 17:02:08 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int launch_file(t_process *p)
|
int launch_file(t_process *p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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 16:49:10 by wescande ### ########.fr */
|
/* Updated: 2017/03/07 17:04:54 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
t_redirmap g_redirmap[] =
|
t_redirmap g_redirmap[] =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
void process_reset(t_process *p)
|
void process_reset(t_process *p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
void process_setsig(void)
|
void process_setsig(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int redirect_dgreat(t_redir *redir)
|
int redirect_dgreat(t_redir *redir)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int redirect_dless(t_redir *redir)
|
int redirect_dless(t_redir *redir)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int redirect_great(t_redir* redir)
|
int redirect_great(t_redir* redir)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int redirect_greatand(t_redir *redir)
|
int redirect_greatand(t_redir *redir)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int redirect_less(t_redir *redir)
|
int redirect_less(t_redir *redir)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int redirect_lessand(t_redir *redir)
|
int redirect_lessand(t_redir *redir)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "exec.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
t_itof g_setprocessmap[] =
|
t_itof g_setprocessmap[] =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "glob.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int is_directory(const char *path)
|
int is_directory(const char *path)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "glob.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** expand_brace return expansion of a string.
|
** expand_brace return expansion of a string.
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "glob.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** glob return expansion of a string.
|
** glob return expansion of a string.
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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[])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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[])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int do_job_notification(void)
|
int do_job_notification(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int job_addprocess(t_process *p)
|
int job_addprocess(t_process *p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
void job_getrank(int (*rank)[2])
|
void job_getrank(int (*rank)[2])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int job_is_completed(int id)
|
int job_is_completed(int id)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int job_is_stopped(int id)
|
int job_is_stopped(int id)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
void job_kill_all(void)
|
void job_kill_all(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
void job_notify_change(int id)
|
void job_notify_change(int id)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
void job_remove(int id)
|
void job_remove(int id)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
void job_update_status(void)
|
void job_update_status(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
int job_wait(int id)
|
int job_wait(int id)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue