gonna add processes inside of job
This commit is contained in:
parent
6cfac2eaff
commit
87b9fab083
5 changed files with 24 additions and 11 deletions
|
|
@ -23,9 +23,6 @@ typedef long long t_type;
|
|||
|
||||
struct s_exec
|
||||
{
|
||||
int fdin;
|
||||
int fdout;
|
||||
int amp;
|
||||
char *aol_status;
|
||||
int aol_search;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,19 +17,34 @@
|
|||
# include <termios.h>
|
||||
# include "libft.h"
|
||||
|
||||
typedef struct s_job t_job;
|
||||
typedef struct s_jobc t_jobc;
|
||||
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 pid;
|
||||
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 completed;
|
||||
char stopped;
|
||||
int status;
|
||||
};
|
||||
|
||||
struct s_jobc
|
||||
{
|
||||
t_list *list;
|
||||
t_list *first_job;
|
||||
pid_t shell_pgid;
|
||||
int current_id;
|
||||
int rank[2];
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Reference in a new issue