-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.h
51 lines (45 loc) · 1.16 KB
/
shell.h
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
#ifndef SHELL_H
#define SHELL_H
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <limits.h>
#include <sys/wait.h>
#include <vector>
#include <iostream>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include "linenoise/linenoise.h"
using namespace std;
int isInString(char *str, char value);
void completionHook (char const *prefix, linenoiseCompletions *lc);
void attCwdFiles();
void attCwd();
void addJob(pid_t pid, char *result, int active, int stopped);
void verifySetStopped(int status, pid_t pid);
void executeProgram(char *cmd, char *result, char *argv, int background, int out, char *outFile, int in, char *inFile);
void executeFile(char *cmd, char *argv, char *result, int background);
void background_(char *bg);
void foreground(char *fg);
void changeDirectory(char *path);
void listFiles();
void printCurrentDirectory();
void listJobs();
void handle(char *result);
void sigHandler(int sig);
void init_shell ();
typedef struct
{
pid_t pid;
string cmd;
int id_job;
int active;
int stopped;
} Job;
#endif /* SHELL_H */