summaryrefslogtreecommitdiff
path: root/exec.h
blob: ca0b1a552bbd0139bdd02d007a917fad8b51da6b (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
#pragma once

#include "utils.h"
#include "preproc.h"


typedef struct {
    int old_fd;
    int new_fd;
} FdRedirect;

DECLARE_VEC(FdRedirect, FdRedirectVec)

typedef struct {
    char** args;
    FdRedirectVec redirs;
    int stdin_fd;
    int stdout_fd;
    IntVec child_close_fds;
    IntVec parent_close_fds;
} ExecutableCommand;


typedef struct {
    KeyValMap aliases;
    KeyValMap shell_vars;
} ShellState;

void process_input_line(char* line, ShellState* shstate);