conflcit resolved

This commit is contained in:
Antoine Riard 2017-03-07 19:43:59 +01:00
commit 69732b44fe
167 changed files with 612 additions and 412 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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_hash(const char *path, char *const av[], char *const envp[]);
extern t_stof g_builtins[];
#endif

View file

@ -6,13 +6,15 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
/* Updated: 2017/03/07 16:36:47 by ariard ### ########.fr */
/* Updated: 2017/03/07 19:43:43 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef EXEC_H
# define EXEC_H
# include <sys/stat.h>
# define PIPE_READ 0
# define PIPE_WRITE 1
@ -42,9 +44,37 @@
# define EXEC_IS_IF_BRANCH(j) (j & EXEC_IF_BRANCH)
# define EXEC_IS_CASE_BRANCH(j) (j & EXEC_CASE_BRANCH)
# include "libft.h"
# include "types.h"
# include "job_control.h"
struct s_data_cmd
{
char **av;
char *path;
t_execf *execf;
struct stat stat;
};
struct s_data_cond
{
t_btree *condition;
t_btree *content;
};
struct s_data_list
{
char *word;
t_ld *list_word;
t_btree *content;
};
union u_process_data
{
struct s_data_cmd cmd;
struct s_data_cond d_while;
struct s_data_cond d_if;
struct s_data_cond d_else;
struct s_data_cond d_elif;
struct s_data_list d_for;
// struct s_data_cond case;
};
enum e_process_type
{
@ -59,12 +89,12 @@ enum e_process_type
};
typedef enum e_process_type t_process_type;
typedef union u_process_data t_process_data;
typedef struct s_data_cond t_data_while;
typedef struct s_data_cond t_data_if;
struct s_process
{
/* char **av; */
/* char *path; */
/* t_execf *execf; */
t_process_type type;
t_process_data data;
pid_t pid;
@ -87,7 +117,6 @@ struct s_exec
int control_count;
};
#include "minishell.h"
extern t_itof g_execmap[];
extern t_itof g_redirmap[];
@ -103,18 +132,19 @@ int exec_or_if(t_btree **ast);
int exec_and_if(t_btree **ast);
int exec_pipe(t_btree **ast);
/* int exec_redir(t_btree **ast); */
int exec_cmd(t_btree **ast);
//int exec_cmd(t_btree **ast);
int exec_leaf(t_btree **ast);
int exec_while(t_btree **ast);
int exec_if(t_btree **ast);
int exec_elif(t_btree **ast);
int exec_else(t_btree **ast);
int exec_until(t_btree **ast);
int exec_default(t_btree **ast);
//int exec_while(t_btree **ast);
//int exec_if(t_btree **ast);
//int exec_elif(t_btree **ast);
//int exec_else(t_btree **ast);
//int exec_until(t_btree **ast);
//int exec_default(t_btree **ast);
int exec_var(t_btree **ast);
int exec_for(t_btree **ast);
int exec_case(t_btree **ast);
int exec_case_branch(t_btree **ast);
//int exec_for(t_btree **ast);
//int exec_case(t_btree **ast);
//int exec_case_branch(t_btree **ast);
int exec_math(t_btree **ast);
int launch_process(t_process *p);
@ -145,8 +175,15 @@ void redir_free(void *data, size_t content_size);
char **token_to_argv(t_ld *ld, int do_match);
# include <sys/stat.h>
int add_new_job(t_job *job);
int error_badidentifier(char *name);
/*
** Mapping pour set les process
*/
int set_process_map(t_process *p, t_btree *ast, t_cmd *cmd);
int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd);
#endif

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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_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_BQUOTES (1 << 1)
# define IS_DQUOTES (1 << 2)

View file

@ -6,15 +6,13 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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
# define GLOB_H
# include "minishell.h"
# define CH(x) ((char **)(x)->content)
# define UCH(x) ((unsigned 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);
unsigned char **ft_strsplit_esc(const char *str,
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

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 SHELL_NAME "minishell"
# include <dirent.h>
# include <sys/stat.h>
# include <signal.h>
# include <fcntl.h>
# include <errno.h>
# include "libft.h"
# include "types.h"
# include "lexer.h"
# include "parser.h"
# include "ft_readline.h"
# include "job_control.h"
# include "exec.h"
# include "builtin.h"
# include "job_control.h"
# include "glob.h"
# include "completion.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
{
char **env;
@ -70,8 +46,6 @@ struct s_data
t_list *lst_func;
};
extern t_stof g_builtins[];
void shell_get_opts(int ac, char **av);
char *shell_get_avdata();
void shell_init(int ac, char **av);

View file

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

View file

@ -6,44 +6,72 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
/* Updated: 2017/03/07 16:37:18 by ariard ### ########.fr */
/* Updated: 2017/03/07 19:43:22 by ariard ### ########.fr */
/* Updated: 2017/03/07 18:35:11 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef 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_flag;
typedef struct s_data t_data;
typedef struct s_line t_line;
typedef struct s_comp t_comp;
typedef struct s_exec t_exec;
typedef struct s_jobc t_jobc;
typedef enum e_mode t_mode;
/*
** Execution types
*/
typedef struct s_lexer t_lexer;
typedef enum e_lexstate t_lexstate;
typedef struct s_token t_token;
typedef struct s_rvwords t_rvwords;
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_redir t_redir;
typedef struct s_cmd t_cmd;
typedef union u_astdata t_astdata;
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 int t_sym;
typedef enum e_parstate t_parstate;
typedef struct s_aggrematch t_aggrematch;
typedef struct s_prodmatch t_prodmatch;
@ -169,4 +197,33 @@ enum e_sym
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

@ -1 +1 @@
Subproject commit 6a6a23b2839a5ec7322bdc6adbb2d3dad3d1023c
Subproject commit bc489f8664fdc24317c31b3069811f54b1178643

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)
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "builtin_read.h"
#include "minishell.h"
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)
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "builtin.h"
#include "minishell.h"
#define CDOPT_L (1 << 0)
#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[])
{

View file

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

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */
/* Updated: 2017/03/07 16:05:47 by ariard ### ########.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.

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "completion.h"
#include "minishell.h"
/*
** 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

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.

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "completion.h"
#include "minishell.h"
/*
** 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**.

View file

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

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "completion.h"
#include "minishell.h"
/*
** 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

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

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.

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "completion.h"
#include "minishell.h"
/*
** 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.

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

View file

@ -6,11 +6,11 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
{

View file

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

View file

@ -6,11 +6,11 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
{

View file

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

View file

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

View file

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

View file

@ -6,35 +6,12 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
/* Updated: 2017/03/07 15:09:45 by jhalford ### ########.fr */
/* Updated: 2017/03/07 17:33:50 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
char **token_to_argv(t_ld *ld, int do_match)
{
char **my_tab;
int index;
char **expand;
char **content;
my_tab = NULL;
while (ld)
{
content = ld->content;
if ((expand = glob(content[0], (unsigned char *)content[1], (unsigned char *)content[2], do_match)))
{
index = -1;
while (expand[++index])
my_tab = ft_sstradd(my_tab, expand[index]);
ft_tabdel(&expand);
}
ld = ld->next;
}
return (my_tab);
}
#include "minishell.h"
/*
int exec_cmd(t_btree **ast)
{
t_process p;
@ -58,4 +35,4 @@ int exec_cmd(t_btree **ast)
if (p.fdout != STDOUT)
close(p.fdout);
return (0);
}
}*/

View file

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

View file

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

View file

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

View file

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

View file

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

38
42sh/src/exec/exec_leaf.c Normal file
View file

@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exec_leaf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
/* Updated: 2017/03/07 17:34:51 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int exec_leaf(t_btree **ast)
{
t_process p;
t_job *job;
job = &data_singleton()->exec.job;
if (set_process(&p, *ast))
return (1);
if (!(launch_process(&p)))
{
job_addprocess(&p);
if (IS_PIPEEND(p))
{
if (JOB_IS_FG(job->attrs))
put_job_in_foreground(job, 0);
else
put_job_in_background(job, 0);
}
job->pgid = 0;
}
if (p.fdout != STDOUT)
close(p.fdout);
return (0);
}

View file

@ -6,11 +6,11 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 10:58:49 by ariard #+# #+# */
/* Updated: 2017/03/07 13:42:11 by ariard ### ########.fr */
/* Updated: 2017/03/07 16:00:24 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
#include "minishell.h"
static int get_math(char *stream, char **var, char **value, char **operator)
{
@ -45,7 +45,7 @@ static int do_math(char **value, char *operator)
ope2 = ft_atoi(&operator[2]);
else
ope2 = 0;
if (operator[0] == '/' && ope2 == 0)
if ((operator[0] == '/' || operator[0] == '%') && ope2 == 0)
ope1 = 0;
else
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "exec.h"
#include "minishell.h"
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)
{

View file

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

View file

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

View file

@ -6,11 +6,11 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
{

View file

@ -6,24 +6,52 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/30 17:33:53 by ariard #+# #+# */
/* Updated: 2017/03/07 16:34:30 by ariard ### ########.fr */
/* Updated: 2017/03/07 19:42:33 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
#include "minishell.h"
int exec_while(t_btree **ast)
{
int ret;
DG("exec while condition");
ft_exec(&(*ast)->left);
DG("ret :[%s]", ft_getenv(data_singleton()->env, "?"));
++data_singleton()->exec.control_count;
while (!(ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0")))
{
DG("in the while");
ft_exec(&(*ast)->right);
ret = ft_atoi(ft_getenv(data_singleton()->env, "?"));
ft_exec(&(*ast)->left);
}
--data_singleton()->exec.control_count;
exit(ret);
return (0);
}
static int do_while(t_process *p)
{
int ret;
return (ret);
}
int launch_while(t_process *p)
{
pid_t pid;
if (SH_IS_INTERACTIVE(data_singleton()->opts))
{
pid = fork();
if (pid == 0)
exit(do_while(p));
else if (pid > 0)
{
p->pid = pid;
process_setgroup(p, pid);
return (0);
}
}
else
do_while(p);
return (1);
}

View file

@ -6,11 +6,11 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */
/* Updated: 2017/03/07 15:08:58 by jhalford ### ########.fr */
/* Updated: 2017/03/07 17:00:45 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
#include "minishell.h"
t_itof g_execmap[] =
{
@ -20,18 +20,18 @@ t_itof g_execmap[] =
{TK_AND_IF, &exec_and_if},
{TK_OR_IF, &exec_or_if},
{TK_PIPE, &exec_pipe},
{TK_WHILE, &exec_while},
{TK_IF, &exec_if},
{TK_WHILE, &exec_leaf},
{TK_IF, &exec_leaf},
{TK_ELIF, &exec_elif},
{TK_ELSE, &exec_else},
{TK_UNTIL, &exec_until},
{TK_FOR, &exec_for},
{TK_CASE, &exec_case},
{TK_ELSE, &exec_leaf},
{TK_UNTIL, &exec_leaf},
{TK_FOR, &exec_leaf},
{TK_CASE, &exec_leaf},
{TK_PAREN_OPEN, &exec_case_branch},
{TK_ASSIGNEMENT_WORD, &exec_var},
{MATH, &exec_math},
/* {TK_SUBSHELL, &exec_}, */
{CMD, &exec_cmd},
/* {TK_SUBSHELL, &exec_leaf}, */
{CMD, &exec_leaf},
{0, 0},
};
@ -44,9 +44,9 @@ int ft_exec(t_btree **ast)
if (!*ast)
return (0);
item = (*ast)->item;
while (g_execmap[i].type)
while (g_execmap[i].id)
{
if (item->type == g_execmap[i].type)
if (item->type == g_execmap[i].id)
return ((*g_execmap[i].f)(ast));
i++;
}

View file

@ -0,0 +1,40 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* launch_builtin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:48:24 by jhalford #+# #+# */
/* Updated: 2017/03/07 16:51:58 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int launch_builtin(t_process *p)
{
pid_t pid;
if (IS_PIPESINGLE(*p))
{
if (process_redirect(p))
return (0);
set_exitstatus((*p->data.cmd.execf)(p->data.cmd.path, p->data.cmd.av, data_singleton()->env), 1);
return (0);
}
pid = fork();
if (pid == 0)
{
process_setgroup(p, 0);
process_setsig();
if (process_redirect(p))
exit (1);
exit((*p->data.cmd.execf)(p->data.cmd.path, p->data.cmd.av, data_singleton()->env));
}
else if (pid > 0)
return (pid);
else if (pid == -1)
ft_dprintf(2, "{red}%s: internal fork error{eoc}\n", SHELL_NAME);
return (0);
}

View file

@ -6,54 +6,44 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 14:53:31 by jhalford #+# #+# */
/* Updated: 2017/03/07 14:54:18 by jhalford ### ########.fr */
/* Updated: 2017/03/07 17:02:08 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int launch_file(t_process *p)
{
int pid;
if (p->attrs & PROCESS_BUILTIN && IS_PIPESINGLE(*p))
{
if (process_redirect(p))
return (1);
set_exitstatus((*p->execf)(p->path, p->av, data_singleton()->env), 1);
return (1);
}
p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_RUNNING;
if (p->attrs & (PROCESS_BINARY | PROCESS_SCRIPT)
&& access(p->path, X_OK) == -1)
{
ft_dprintf(2, "{red}%s: permission denied: %s{eoc}\n", SHELL_NAME, p->av[0]);
set_exitstatus(126, 1);
return (1);
}
pid = fork();
if (pid == 0)
{
if (p->attrs & PROCESS_UNKNOWN)
if (!p->data.cmd.path)
{
ft_dprintf(2, "{red}%s: command not found: %s{eoc}\n", SHELL_NAME, p->av[0]);
ft_dprintf(2, "{red}%s: command not found: %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
exit(127);
}
else if (S_ISDIR(p->data.cmd.stat.st_mode))
{
ft_dprintf(2, "{red}%s: %s: Is a directory{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
exit(126);
}
else if (access(p->data.cmd.path, X_OK) == -1)
{
ft_dprintf(2, "{red}%s: permission denied: %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
exit(126);
}
process_setgroup(p, 0);
process_setsig();
if (process_redirect(p))
exit (1);
if (p->attrs & PROCESS_BUILTIN)
exit((*p->execf)(p->path, p->av, data_singleton()->env));
(*p->execf)(p->path, p->av, data_singleton()->env);
ft_dprintf(2, "{red}%s: internal execve error on %s{eoc}\n", SHELL_NAME, p->av[0]);
(*p->data.cmd.execf)(p->data.cmd.path, p->data.cmd.av, data_singleton()->env);
ft_dprintf(2, "{red}%s: internal execve error on %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
}
else if (pid > 0)
{
p->pid = pid;
process_setgroup(p, pid);
return (0);
}
return (pid);
else if (pid == -1)
ft_dprintf(2, "{red}%s: internal fork error{eoc}\n", SHELL_NAME);
return (1);
return (0);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
/* Updated: 2017/03/07 15:04:44 by jhalford ### ########.fr */
/* Updated: 2017/03/07 17:04:54 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,29 +15,37 @@
t_itof g_launchmap[] =
{
{PROCESS_FUNCTION, NULL},
{PROCESS_BUILTIN, NULL},
{PROCESS_BUILTIN, launch_builtin},
{PROCESS_FILE, launch_file},
{PROCESS_SUBSHELL, NULL},
{PROCESS_WHILE, NULL},
{PROCESS_IF, NULL},
{PROCESS_FOR, NULL},
{PROCESS_CASE, NULL},
{0, NULL}
};
int launch_process(t_process *p)
{
int i;
int pid;
i = 0;
/* DG("gonna launch [%s]", p->av[0]); */
/* DG("fdin=[%i]", p->fdin); */
/* DG("fdout=[%i]", p->fdout); */
while (g_launchmap[i].type)
while (g_launchmap[i].id)
{
if (p->type == g_launchmap[i].type)
if (p->type == g_launchmap[i].id)
{
if (!g_launchmap[i].f)
return (-1);
return ((*g_launchmap[i].f)(p));
p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_RUNNING;
if ((pid = (*g_launchmap[i].f)(p)))
{
p->pid = pid;
process_setgroup(p, pid);
return (0);
}
}
i++;
}
return (-1);

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "job_control.h"
#include "minishell.h"
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[] =
{

View file

@ -6,17 +6,17 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/07 17:44:22 by jhalford #+# #+# */
/* Updated: 2017/03/06 12:29:17 by wescande ### ########.fr */
/* Updated: 2017/03/07 14:36:21 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
#include "minishell.h"
void process_reset(t_process *p)
{
p->av = NULL;
p->path = NULL;
p->execf = NULL;
// p->av = NULL;
// p->path = NULL;
// p->execf = NULL;
p->pid = 0;
/* p->fdin = STDIN; */
/* p->fdout = STDOUT; */
@ -24,4 +24,6 @@ void process_reset(t_process *p)
p->redirs = NULL;
p->status = -1;
p->attrs = 0;
// p->condition = NULL;
// p->content = NULL;
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */
/* Updated: 2017/03/07 14:49:45 by jhalford ### ########.fr */
/* Updated: 2017/03/07 16:54:13 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,27 +14,27 @@
int process_setexec(t_process *p)
{
p->path = NULL;
p->data.cmd.path = NULL;
p->data.cmd.execf = NULL;
/* if ((p->execf = is_function(p))) */
/* p->type = PROCESS_FUNCTION; */
if ((p->data.cmd.execf = is_builtin(p)))
p->type = PROCESS_BUILTIN;
else if (ft_hash(p))
else if (ft_strchr(p->data.cmd.av[0], '/'))
{
p->data.cmd.execf = &execve;
p->type = PROCESS_FILE;
}
else if (ft_strchr(p->av[0], '/'))
{
p->data.cmd.execf = &execve;
p->type = PROCESS_FILE;
p->data.cmd.path = ft_strdup(p->av[0]);
p->data.cmd.path = ft_strdup(p->data.cmd.av[0]);
stat(p->data.cmd.path, &p->data.cmd.stat);
}
else
{
p->execf = NULL;
p->attrs |= PROCESS_UNKNOWN;
return (1);
p->type = PROCESS_FILE;
if (ft_hash(p))
{
p->data.cmd.execf = &execve;
stat(p->data.cmd.path, &p->data.cmd.stat);
}
}
return (0);
}

View file

@ -10,8 +10,8 @@
/* */
/* ************************************************************************** */
#include "job_control.h"
#include "exec.h"
#include "minishell.h"
#include "minishell.h"
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)
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "exec.h"
#include "minishell.h"
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)
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,11 +6,11 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
/* Updated: 2017/03/07 15:09:36 by jhalford ### ########.fr */
/* Updated: 2017/03/07 15:34:31 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec.h"
#include "minishell.h"
int set_process(t_process *p, t_btree *ast)
{
@ -28,8 +28,6 @@ int set_process(t_process *p, t_btree *ast)
|| (EXEC_IS_OR_IF(exec->attrs)
&& ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0") == 0))
return (1);
if (!(p->av = token_to_argv(cmd->token, 1)))
return (1);
fds[PIPE_WRITE] = STDOUT;
fds[PIPE_READ] = STDIN;
if (op == TK_AMP)
@ -41,14 +39,8 @@ int set_process(t_process *p, t_btree *ast)
p->fdout = fds[PIPE_WRITE];
exec->fdin = fds[PIPE_READ];
p->redirs = ft_lstmap(cmd->redir, ft_id);
t_list *tmp = p->redirs;
while (tmp)
{
t_redir *toto = tmp->content;
printf("IIIIIIIIIIIIIIIIIIIIIII%lld |%d| {%s}\n", toto->type, toto->n, toto->word);
tmp= tmp->next;
}
process_setexec(p);
if (set_process_map(p, ast, cmd))
return (1);
if (exec->control_count)
p->attrs |= PROCESS_CONTROL;
return (0);

View file

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* set_process_cmd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:06:05 by wescande #+# #+# */
/* Updated: 2017/03/07 15:50:51 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd)
{
if (!(p->data.cmd.av = token_to_argv(cmd->token, 1)))
return (1);
process_setexec(p);
return (0);
}

View file

@ -0,0 +1,52 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* set_process_map.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:08:12 by wescande #+# #+# */
/* Updated: 2017/03/07 15:50:56 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
t_itof g_setprocessmap[] =
{
{TK_NEWLINE, NULL},
{TK_SEMI, NULL},
{TK_AMP, NULL},
{TK_AND_IF, NULL},
{TK_OR_IF,NULL},
{TK_PIPE, NULL},
{TK_WHILE, NULL},
{TK_IF, NULL},
{TK_ELIF, NULL},
{TK_ELSE, NULL},
{TK_UNTIL, NULL},
{TK_FOR, NULL},
{TK_CASE, NULL},
{TK_PAREN_OPEN, NULL},
{TK_ASSIGNEMENT_WORD, NULL},
{MATH, NULL},
/* {TK_SUBSHELL, &exec_}, */
{CMD, &set_process_cmd},
{0, NULL}
};
int set_process_map(t_process *p, t_btree *ast, t_cmd *cmd)
{
int i;
i = 0;
if (!ast)
return (0);
while (g_setprocessmap[i].id)
{
if (p->type == g_setprocessmap[i].id)
return ((*g_setprocessmap[i].f)(p, ast, cmd));
i++;
}
return (0);
}

View file

@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* token_to_argv.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 15:55:53 by wescande #+# #+# */
/* Updated: 2017/03/07 15:56:25 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
char **token_to_argv(t_ld *ld, int do_match)
{
char **my_tab;
int index;
char **expand;
char **content;
my_tab = NULL;
while (ld)
{
content = ld->content;
if ((expand = glob(content[0],
(unsigned char *)content[1],
(unsigned char *)content[2], do_match)))
{
index = -1;
while (expand[++index])
my_tab = ft_sstradd(my_tab, expand[index]);
ft_tabdel(&expand);
}
ld = ld->next;
}
return (my_tab);
}

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "glob.h"
#include "minishell.h"
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)
{

View file

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

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "glob.h"
#include "minishell.h"
/*
** 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,
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)
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "glob.h"
#include "minishell.h"
/*
** 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,
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,
const unsigned char *esc, char c)

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "glob.h"
#include "minishell.h"
/*
** 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,
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)
{

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/18 11:20:11 by gwojda #+# #+# */
/* Updated: 2017/03/07 14:43:33 by jhalford ### ########.fr */
/* Updated: 2017/03/07 16:56:04 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,10 +18,10 @@ int ft_add_hash(t_process *p)
t_hash hash;
if (!(hash.path = ft_findexec(
ft_getenv(data_singleton()->env, "PATH"), p->av[0])))
ft_getenv(data_singleton()->env, "PATH"), p->data.cmd.av[0])))
return (0);
hash.key = ft_strdup(p->av[0]);
id = ft_hash_str(p->av[0]);
hash.key = ft_strdup(p->data.cmd.av[0]);
id = ft_hash_str(p->data.cmd.av[0]);
ft_lsteadd(&(g_hash[id]), ft_lstnew(&hash, sizeof(t_hash)));
p->data.cmd.path = ft_strdup(hash.path);
return (1);

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/18 11:06:19 by gwojda #+# #+# */
/* Updated: 2017/03/04 18:50:56 by ariard ### ########.fr */
/* Updated: 2017/03/07 16:02:41 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/18 11:08:40 by gwojda #+# #+# */
/* Updated: 2017/02/18 16:42:12 by gwojda ### ########.fr */
/* Updated: 2017/03/07 14:45:20 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,12 +18,12 @@ int ft_is_hash(t_process *p)
t_list *ref;
int id;
id = ft_hash_str(p->av[0]);
id = ft_hash_str(p->data.cmd.av[0]);
list = g_hash[id];
ref = list;
while (list)
{
if (!ft_strcmp(((t_hash *)list->content)->key, p->av[0]))
if (!ft_strcmp(((t_hash *)list->content)->key, p->data.cmd.av[0]))
{
if (access(((t_hash *)list->content)->path, X_OK))
{
@ -31,7 +31,7 @@ int ft_is_hash(t_process *p)
ft_lstdelone(&list, &ft_hash_free);
return (0);
}
p->path = ft_strdup(((t_hash *)list->content)->path);
p->data.cmd.path = ft_strdup(((t_hash *)list->content)->path);
return (1);
}
ref = list;

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[])
{

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[])
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "job_control.h"
#include "minishell.h"
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)
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "job_control.h"
#include "minishell.h"
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)
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "job_control.h"
#include "minishell.h"
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)
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "job_control.h"
#include "minishell.h"
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])
{

View file

@ -10,7 +10,7 @@
/* */
/* ************************************************************************** */
#include "job_control.h"
#include "minishell.h"
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)
{

View file

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

View file

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

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