-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibs.h
62 lines (48 loc) · 1.52 KB
/
libs.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
52
53
54
55
56
57
58
59
60
61
62
//PANAGIOTIS KONTOEIDIS
//1115201900266
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "fcntl.h"
#include "sys/wait.h"
#include "unistd.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <sys/types.h>
#include <signal.h>
using namespace std;
#define MAX_COMMAND_SIZE 1024
typedef std::vector<char* > tokens;
typedef std::vector<tokens > history;
typedef std::vector<pair<char *,char *>> table;
extern int history_flag;
extern int output_redirection_flag;
extern int input_redirection_flag;
extern int append_flag;
extern int pipe_flag;
extern int redirection_flag;
extern list<int> rpos;
extern int stopped_processes_counter;
extern table alias_table;
tokens read_command();
tokens split_command(char * command);
void print_history(history myhistory);
tokens history_command(history myhistory, tokens command);
tokens redirections_pipes_in_cmd(tokens parameters);
void call_for_redirection(tokens command);
void output_redirection(const char * output_file);
void input_redirection(const char * output_file);
void append_redirection(const char * output_file);
void pipes(tokens command1, tokens command2);
void check_for_pipes(tokens command);
void call_for_pipes(tokens command);
void signal_handler(int);
void signal_handler2(int);
void add_alias(tokens command);
void remove_alias(tokens command);
void print_alias();
tokens check_for_aliases(tokens command);
tokens env_variables(tokens command); //parses command and replaces environment variables
void cd_call(tokens command);