#include #include #include #include #include #include #include #include #include #include #include #ifndef ESH_TYPES_H #define ESH_TYPES_H typedef enum { BACKGROUND, FOREGROUND } ESH_JOB_TYPE; typedef enum { NO_CONDITION, // ex. commands delimited by ';' PREVIOUS_EXIT_SUCCESS, // ex. commands delimited by '&&' PREVIOUS_EXIT_FAILED // ex. commands delimited by '||' } ESH_JOB_CONDITION; typedef enum { LOGIC_AND = 1, LOGIC_OR = 2, SEMICOLON = 3, BIT_AND = 4, BIT_OR = 5, NOT_A_DELIMITER = 0 } ESH_JOB_DELIMITER; typedef struct { char* command; char** command_tokens; int command_tokens_num; ESH_JOB_TYPE job_type; ESH_JOB_CONDITION job_start_condition; pid_t job_pid; int stdin_fd; int stdout_fd; int stderr_fd; } EShJob; typedef struct { char* build_ref; struct passwd* user_data; char* current_working_dir; char* config_file_path; // path to file, containing configurations (changeable via cmd line args) char* history_file_path; // path to file, where entered commands history is stored (changeable via settings/cmd line args) int history_limit; // max lines of commands, which can be stored (changeable via settings/cmd line args) // TODO: set this to max background jobs limit! int max_jobs_number; // max active jobs (foreground & background) limit (changeable via settings/cmd line args) int max_command_length; // max length of single command (changeable via settings/cmd line args) int max_command_tokens; // TODO: max arguments of single command int max_command_token_size; // TODO char** history_command_list; int history_command_list_size; int max_invite_message_len; char* invite_message; int jobs_number; EShJob* jobs_list; int exited; // used to stop threads on exiting } EShInfo; extern EShInfo* esh_info_global; #endif // ESH_TYPES_H