2017-05-14 18:54:39 +00:00
|
|
|
//
|
|
|
|
// Created by Antoine Bartuccio on 14/05/2017.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef FISH_FISH_TYPES_H
|
|
|
|
#define FISH_FISH_TYPES_H
|
|
|
|
|
2017-05-29 14:19:42 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
|
2017-05-16 20:14:06 +00:00
|
|
|
#define EXIT_SIGNAL -100
|
2017-05-29 13:19:52 +00:00
|
|
|
#define ERROR_STRING "\n"
|
2017-05-16 20:14:06 +00:00
|
|
|
|
2017-05-14 18:54:39 +00:00
|
|
|
/* Custom types */
|
|
|
|
|
2017-05-16 17:15:51 +00:00
|
|
|
typedef enum {
|
|
|
|
NONE,
|
|
|
|
PIPE,
|
|
|
|
BACKGROUND_PROCESS,
|
|
|
|
AND,
|
2017-05-18 00:09:44 +00:00
|
|
|
OR,
|
2017-06-11 16:43:05 +00:00
|
|
|
REVERSE_AND,
|
|
|
|
REDIRECT_STDOUT_ERASE,
|
|
|
|
REDIRECT_STDOUT_APPEND,
|
|
|
|
REDIRECT_STDERR_ERASE,
|
|
|
|
REDIRECT_STDERR_APPEND,
|
|
|
|
REDIRECT_STDIN
|
2017-05-16 17:15:51 +00:00
|
|
|
} shell_operator ;
|
|
|
|
|
2017-06-11 15:52:05 +00:00
|
|
|
typedef enum {
|
|
|
|
READ,
|
|
|
|
WRITE,
|
|
|
|
READ_AND_WRITE
|
|
|
|
} redirection_mode ;
|
|
|
|
|
2017-05-14 18:54:39 +00:00
|
|
|
typedef struct {
|
2017-05-15 09:22:53 +00:00
|
|
|
char ** words;
|
|
|
|
int size;
|
2017-05-14 18:54:39 +00:00
|
|
|
} WordArray;
|
|
|
|
|
2017-05-15 13:02:58 +00:00
|
|
|
typedef struct elem {
|
|
|
|
char * word;
|
|
|
|
struct elem * previous;
|
|
|
|
struct elem * next;
|
|
|
|
} WordListElement;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int size;
|
|
|
|
WordListElement * first;
|
|
|
|
WordListElement * last;
|
|
|
|
} WordList;
|
|
|
|
|
2017-05-29 13:19:52 +00:00
|
|
|
|
2017-05-14 18:54:39 +00:00
|
|
|
typedef struct {
|
2017-05-15 09:22:53 +00:00
|
|
|
char *PS1;
|
2017-05-29 14:19:42 +00:00
|
|
|
char *PS2;
|
2017-05-29 17:42:02 +00:00
|
|
|
struct passwd* passwd;
|
2017-05-14 18:54:39 +00:00
|
|
|
} Settings;
|
|
|
|
|
2017-06-11 00:10:11 +00:00
|
|
|
typedef struct {
|
|
|
|
int to_use;
|
2017-06-11 15:52:05 +00:00
|
|
|
int nb;
|
|
|
|
int nb_max;
|
|
|
|
int file_use;
|
|
|
|
int tmp_files[2];
|
|
|
|
char * files_name[2];
|
|
|
|
redirection_mode read;
|
2017-06-11 00:10:11 +00:00
|
|
|
} pipe_redirection;
|
2017-05-14 18:54:39 +00:00
|
|
|
|
|
|
|
typedef int (builtinCommand) (WordArray*);
|
|
|
|
|
|
|
|
#endif //FISH_FISH_TYPES_H
|