-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatastruct.h
More file actions
56 lines (47 loc) · 896 Bytes
/
Copy pathdatastruct.h
File metadata and controls
56 lines (47 loc) · 896 Bytes
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
#ifndef __DATASTRUCT_H
#define __DATASTRUCT_H
#include <sys/types.h>
#define HISTORY_LEN 500
#define CMD_LEN 50
// status about a job
#define RUNNING "running"
#define STOPPED "stopped"
#define DONE "done"
/*
* a struct of a command
* @author shoumu
*/
typedef struct simple_command
{
char ** args;
char *input;
char *output;
struct simple_command *next; // use in the pipe command
}simple_command;
typedef struct command
{
int is_back;
simple_command *sim_cmd;
}command;
/*
* a struct of history
* use a loop structure to store the history command
* if end > HISTORY_LEN then end = end % HISTORY_LEN
*/
typedef struct history
{
int start;
int end;
char cmds[HISTORY_LEN][CMD_LEN];
}history;
/*
* struct that use to save a process's status
*/
typedef struct job
{
pid_t pid; // process number
char cmd[CMD_LEN];
char status[10];
struct job *next;
}job;
#endif