This commit is contained in:
Jack Halford 2016-12-13 13:00:28 +01:00
commit a948a65cbb
6 changed files with 23 additions and 13 deletions

View file

@ -23,9 +23,6 @@ typedef long long t_type;
struct s_exec
{
int fdin;
int fdout;
int amp;
char *aol_status;
int aol_search;
};

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
/* Updated: 2016/12/13 12:57:25 by jhalford ### ########.fr */
/* Updated: 2016/12/13 13:00:19 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,16 +20,28 @@
# define TYPE_BUILTIN
typedef struct s_job t_job;
typedef struct s_process t_process;
typedef struct s_jobc t_jobc;
struct s_job
{
int id;
pid_t pgid;
char notified;
char *command;
int foreground;
t_list *first_process;
};
struct s_process
{
char **argv;
pid_t pid;
int fdin;
int fdout;
char *command;
t_type type;
char completed;
char stopped;
int status;
};
struct s_jobc

View file

@ -14,9 +14,9 @@
int exec_ampersand(t_btree **ast)
{
data_singleton()->exec.amp = 1;
data_singleton()->exec.foreground = 1;
ft_exec(&(*ast)->left);
data_singleton()->exec.amp = 0;
data_singleton()->exec.foreground = 0;
ft_exec(&(*ast)->right);
btree_delone(ast, &ast_free);
return (0);

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 17:27:08 by jhalford #+# #+# */
/* Updated: 2016/12/13 12:24:08 by jhalford ### ########.fr */
/* Updated: 2016/12/13 13:00:20 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -55,7 +55,7 @@ int ft_cmd_exec(char *execpath, char **argv)
{
ft_strdel(&execpath);
g_pid = pid;
if (data_singleton()->exec.amp)
if (data_singleton()->exec.foreground)
job_new(argv, pid);
else if (data_singleton()->exec.fdout == STDOUT)
{

View file

@ -14,8 +14,9 @@
t_parser g_parser[] =
{
{TK_SEMI | TK_AMP, &parse_separator},
{TK_SEMI, &parse_separator},
{TK_AND_IF | TK_OR_IF, &parse_separator},
{TK_AMP, &parse_separator},
{TK_PIPE, &parse_separator},
{TK_LESS, &parse_less},
{TK_GREAT, &parse_great},