Livl Shell  0.1
Livl Shell is an intermediate reimplementation of the bash shell in C language.
typedef.h
Go to the documentation of this file.
1 
7 #ifndef TYPEDEF_H
8 #define TYPEDEF_H
9 
10 #include <stddef.h>
11 #include <sys/types.h>
12 #include "constants.h"
13 
17 typedef enum
18 {
19  AND, // &&
20  OR, // ||
21  REDIRECTION_APPEND_OUTPUT, // >>
22  REDIRECTION_APPEND_INPUT, // <<
23  SEMICOLON, // ;
24  PIPE, // |
25  BACKGROUND, // &
26  REDIRECTION_OUTPUT, // >
27  REDIRECTION_INPUT, // <
28  UNKNOWN, // Unknown operator
29 } OperatorType;
30 
44 typedef struct
45 {
46  pid_t pid;
48  char *command;
50 
67 typedef struct
68 {
69  char *input_file;
70  char *output_file;
73 } Redirection;
74 
97 typedef struct
98 {
99  char *command;
100  char **arguments;
105 } Command;
106 
123 typedef struct
124 {
125  Command *commands; // Array of commands
126  char **operators; // Array of operators
127  size_t num_commands; // Number of commands
128  size_t num_operators; // Number of operators
130 
144 typedef struct
145 {
150 
161 typedef struct
162 {
163  char *alias;
164  char *command;
165 } Alias;
166 
167 #endif // TYPEDEF_H
Redirection::input_file
char * input_file
Definition: typedef.h:69
CommandSequence::num_commands
size_t num_commands
Definition: typedef.h:127
CommandSequence
Struct that represents a command sequence.
Definition: typedef.h:123
CommandSequence::num_operators
size_t num_operators
Definition: typedef.h:128
OperatorType
OperatorType
Definition: typedef.h:17
MAX_HISTORY_SIZE
#define MAX_HISTORY_SIZE
The max size of the history.
Definition: constants.h:87
CommandHistory::current_index
int current_index
Definition: typedef.h:148
Command::num_arguments
int num_arguments
Definition: typedef.h:103
CommandHistory
Struct that represents the command history.
Definition: typedef.h:144
Command::redirection
Redirection redirection
Definition: typedef.h:104
Command
Struct that represents a command.
Definition: typedef.h:97
Command::complete_command
char ** complete_command
Definition: typedef.h:101
CommandSequence::commands
Command * commands
Definition: typedef.h:125
Redirection::output_file
char * output_file
Definition: typedef.h:70
Redirection::append_input
int append_input
Definition: typedef.h:71
CommandHistory::history_count
int history_count
Definition: typedef.h:147
Command::input_string
char * input_string
Definition: typedef.h:102
Command::arguments
char ** arguments
Definition: typedef.h:100
Redirection
Struct that represents a redirection.
Definition: typedef.h:67
BackgroundProcess::command
char * command
Definition: typedef.h:48
Command::command
char * command
Definition: typedef.h:99
constants.h
Header file defining constants.
CommandSequence::operators
char ** operators
Definition: typedef.h:126
Redirection::append_output
int append_output
Definition: typedef.h:72
BackgroundProcess
Struct that represents a background process.
Definition: typedef.h:44
Alias
Struct that represents an alias.
Definition: typedef.h:161
Alias::alias
char * alias
Definition: typedef.h:163
BackgroundProcess::job_number
int job_number
Definition: typedef.h:47
BackgroundProcess::pid
pid_t pid
Definition: typedef.h:46
Alias::command
char * command
Definition: typedef.h:164
MAX_INPUT_LENGTH
#define MAX_INPUT_LENGTH
The max length of the input string.
Definition: constants.h:21