-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructures_constants.h
More file actions
57 lines (48 loc) · 1.03 KB
/
structures_constants.h
File metadata and controls
57 lines (48 loc) · 1.03 KB
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
#define _GNU_SOURCE
#include <linux/limits.h>
#include <limits.h>
#include <stdbool.h>
#include <sys/types.h>
#include <stdio.h>
#ifndef STRUCTURES_CONSTANTS_H
#define STRUCTURES_CONSTANTS_H
#define ERROR_MESSAGE "An error has occurred\n"
#define MAX_PIDS 20
#define MAX_ARGUMENTS 101
#define BUFFER_SIZE 1024
#define DEFAULT_PATHS "/bin"
#define MODE_NORMAL 1
#define MODE_REDIRECT 2
#define MODE_PIPE 3
typedef struct Environment {
/* Paths to be searched like /bin /usr/bin. */
char *paths;
/* Current working directory. */
char cwd[PATH_MAX];
/* Should path be freed? */
bool path_set_by_user;
} Environment;
typedef struct Process
{
/* Process id. */
pid_t pid;
int stdin[2];
int stdout[2];
int stderr[2];
int mode;
int redirection;
} Process;
typedef struct Launch
{
struct Environment *environment;
char *command;
char *args;
char *redirection;
} Launch;
typedef struct PreLaunch
{
struct Process *process;
char **argv;
char *path_to_run;
} PreLaunch;
#endif