aboutsummaryrefslogtreecommitdiff
path: root/include/eval.h
blob: 31f729b4ce058fcdef8d09a993d90add90a6661f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   eval.h                                             :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/01 17:05:30 by charles           #+#    #+#             */
/*   Updated: 2020/04/01 17:53:26 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef EVAL_H
# define EVAL_H

/*
** \file   eval.h
** \brief  Evaluation module
*/

# include "minishell.h"
# include "ast.h"

/*
** \brief        Evaluation state struct
*/

typedef struct
{
	int			pipe_in[2];
	int			pipe_out[2];
	t_path		path;
	t_env		env;
}				t_eval_state;

/*
** \brief      Evaluation status struct
*/

typedef struct	s_eval_status
{
	char		*err;
	int			status;
}				t_eval_status;

/*
** eval.c
*/

int				eval(t_eval_state *state, t_ast *ast);

/*
** exec.c
*/

bool			exec_is_path(char *path_str);
bool			exec_is_valid(char *exec_path);
char			*exec_search_path(t_path path, char *path_var, char *exec_name);

/*
** pipe.c
*/

int				pipe_setup_parent(t_cmd *cmd, int pipe_in[2], int pipe_out[2]);
int				pipe_setup_child(int pipe_in[2], int pipe_out[2]);

#endif