#include "io.h" #include #include #include #include #include #include #include #include #include "subprocess.h" #include "proc.h" #include "missions/all.h" #include "state.h" int main() { int pfd = subprocess("bash"); state_t *state = new_state(pfd, STDIN_FILENO, STDOUT_FILENO); // Running a mission is just a one liner! run_mission(state, vim1); char *line; size_t buffer_size = 1; int fds[] = {state->pfd, state->ifd, -1}; while (true) { int *readable = get_readable(fds); int index = 0; int fd; while ((fd = readable[index]) != -1) { char *data = read_line(fd, 1024); if (fd == state->ifd) { write(pfd, data, strlen(data)); } else { printf(data); } index++; } } }