diff --git a/Makefile b/Makefile index cc40639..b8c5cb7 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ # **************************************************************************** # # # -# ::: o_ :::::: ::: # -# Makefile :+: / :+::+: :+: # -# +:+ > +:++:+ +:+ # -# By: whaffman +#+ +:+ +#++#++:++#++ # -# +#+ +#+#+ +#++#+ +#+ \o/ # -# Created: 2024/10/15 11:48:46 by whaffman #+#+# #+#+# #+# #+# | # -# Updated: 2024/11/07 15:28:08 by whaffman ### ### ### ### / \ # +# :::::::: # +# Makefile :+: :+: # +# +:+ # +# By: whaffman +#+ # +# +#+ # +# Created: 2024/10/15 11:48:46 by whaffman #+# #+# # +# Updated: 2025/02/04 16:13:00 by whaffman ######## odam.nl # # # # **************************************************************************** # diff --git a/inc/minishell.h b/inc/minishell.h index 752f279..26e6365 100644 --- a/inc/minishell.h +++ b/inc/minishell.h @@ -1,170 +1,19 @@ -/** - * @file minishell.h - * - * @brief Header file for the Minishell project. - * - * This header file includes all necessary libraries and headers required for the Minishell project. - * The following is a list of included headers and the functions or system calls they provide: - * - * @headerfile - * - int printf(const char *format, ...); - * - Prints formatted data to stdout. - * - void perror(const char *s); - * - Prints a descriptive error message to stderr. - * - * @headerfile - * - void* malloc(size_t size); - * - Allocates memory dynamically. - * - void free(void *ptr); - * - Frees dynamically allocated memory. - * - void exit(int status); - * - Terminates the calling process. - * - char* getenv(const char *name); - * - Retrieves the value of an environment variable. - * - * @headerfile - * - ssize_t write(int fd, const void *buf, size_t count); - * - Writes data to a file descriptor. - * - int access(const char *pathname, int mode); - * - Checks user's permissions for a file. - * - ssize_t read(int fd, void *buf, size_t count); - * - Reads data from a file descriptor. - * - int close(int fd); - * - Closes a file descriptor. - * - pid_t fork(void); - * - Creates a new process. - * - char* getcwd(char *buf, size_t size); - * - Gets the current working directory. - * - int chdir(const char *path); - * - Changes the current working directory. - * - int unlink(const char *pathname); - * - Deletes a name from the filesystem. - * - int execve(const char *pathname, char *const argv[], char *const envp[]); - * - Executes a program. - * - int dup(int oldfd); - * - Duplicates a file descriptor. - * - int dup2(int oldfd, int newfd); - * - Duplicates a file descriptor to a specific descriptor number. - * - int pipe(int pipefd[2]); - * - Creates a pipe. - * - int isatty(int fd); - * - Checks if a file descriptor refers to a terminal. - * - char* ttyname(int fd); - * - Returns the name of the terminal associated with a file descriptor. - * - int ttyslot(void); - * - Returns the index of the current terminal. - * - * @headerfile - * - char* strerror(int errnum); - * - Returns a string describing the error number. - * - * @headerfile - * - Required for various system calls and data types. - * - * @headerfile - * - pid_t wait(int *wstatus); - * - Waits for a child process to change state. - * - pid_t waitpid(pid_t pid, int *wstatus, int options); - * - Waits for a specific child process to change state. - * - pid_t wait3(int *wstatus, int options, struct rusage *rusage); - * - Waits for a child process to change state with resource usage information. - * - pid_t wait4(pid_t pid, int *wstatus, int options, struct rusage *rusage); - * - Waits for a specific child process to change state with resource usage information. - * - * @headerfile - * - int open(const char *pathname, int flags, ...); - * - Opens a file. - * - * @headerfile - * - Provides access to the errno variable. - * - * @headerfile - * - void (*signal(int signum, void (*handler)(int)))(int); - * - Sets a signal handler. - * - int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); - * - Examines and changes a signal action. - * - int sigemptyset(sigset_t *set); - * - Initializes a signal set to empty. - * - int sigaddset(sigset_t *set, int signum); - * - Adds a signal to a signal set. - * - int kill(pid_t pid, int sig); - * - Sends a signal to a process. - * - * @headerfile - * - char* readline(const char *prompt); - * - Reads a line of input from the user. - * - void rl_clear_history(void); - * - Clears the history list. - * - void rl_on_new_line(void); - * - Informs the readline library that the cursor is on a new line. - * - void rl_replace_line(const char *text, int clear_undo); - * - Replaces the contents of the current line. - * - void rl_redisplay(void); - * - Redisplays the current line. - * - void add_history(const char *line); - * - Adds a line to the history list. - * - * @headerfile - * - DIR* opendir(const char *name); - * - Opens a directory stream. - * - struct dirent* readdir(DIR *dirp); - * - Reads a directory entry. - * - int closedir(DIR *dirp); - * - Closes a directory stream. - * - * @headerfile - * - int stat(const char *pathname, struct stat *statbuf); - * - Gets file status. - * - int lstat(const char *pathname, struct stat *statbuf); - * - Gets file status, not following symbolic links. - * - int fstat(int fd, struct stat *statbuf); - * - Gets file status for an open file descriptor. - * - * @headerfile - * - int ioctl(int fd, unsigned long request, ...); - * - Manipulates the underlying device parameters of special files. - * - * @headerfile - * - int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); - * - Sets the parameters associated with the terminal. - * - int tcgetattr(int fd, struct termios *termios_p); - * - Gets the parameters associated with the terminal. - * - * @headerfile - * - int tgetent(char *bp, const char *name); - * - Loads the terminal entry for a given terminal name. - * - int tgetflag(const char *id); - * - Gets the boolean value of a terminal capability. - * - int tgetnum(const char *id); - * - Gets the numeric value of a terminal capability. - * - char* tgetstr(const char *id, char **area); - * - Gets the string value of a terminal capability. - * - char* tgoto(const char *cap, int col, int row); - * - Computes a cursor movement string. - * - int tputs(const char *str, int affcnt, int (*putc)(int)); - * - Outputs a string with padding. - */ +/* ************************************************************************** */ +/* */ +/* :::::::: */ +/* minishell.h :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2025/02/04 16:13:13 by whaffman #+# #+# */ +/* Updated: 2025/02/04 16:13:14 by whaffman ######## odam.nl */ +/* */ +/* ************************************************************************** */ + #ifndef MINISHELL_H # define MINISHELL_H -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# include -# include - +# include "allowed.h" # include "libft.h" # include "enviroment.h" diff --git a/src/enviroment/add_enviroment.c b/src/enviroment/add_enviroment.c index 7cf4fd7..8ee6ded 100644 --- a/src/enviroment/add_enviroment.c +++ b/src/enviroment/add_enviroment.c @@ -1,10 +1,18 @@ -#include "enviroment.h" -#include "libft.h" -#include -#include +/* ************************************************************************** */ +/* */ +/* :::::::: */ +/* add_enviroment.c :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2025/02/04 16:13:33 by whaffman #+# #+# */ +/* Updated: 2025/02/04 16:15:35 by whaffman ######## odam.nl */ +/* */ +/* ************************************************************************** */ +#include "minishell.h" -void add_enviroment(t_enviroment **enviroment, char *name, char *value) +void add_enviroment(t_enviroment **enviroment, char *name, char *value) { t_enviroment *new_enviroment; diff --git a/src/enviroment/free_enviroment.c b/src/enviroment/free_enviroment.c index cbdb89f..b79317b 100644 --- a/src/enviroment/free_enviroment.c +++ b/src/enviroment/free_enviroment.c @@ -1,10 +1,20 @@ -#include "enviroment.h" -#include +/* ************************************************************************** */ +/* */ +/* :::::::: */ +/* free_enviroment.c :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2025/02/04 16:13:59 by whaffman #+# #+# */ +/* Updated: 2025/02/04 16:14:04 by whaffman ######## odam.nl */ +/* */ +/* ************************************************************************** */ +#include "minishell.h" -void free_enviroment(t_enviroment *enviroment) +void free_enviroment(t_enviroment *enviroment) { - t_enviroment *next; + t_enviroment *next; while (enviroment != NULL) { diff --git a/src/enviroment/get_enviroment.c b/src/enviroment/get_enviroment.c index d14b039..0b580a3 100644 --- a/src/enviroment/get_enviroment.c +++ b/src/enviroment/get_enviroment.c @@ -1,15 +1,26 @@ -#include "enviroment.h" -#include "libft.h" +/* ************************************************************************** */ +/* */ +/* :::::::: */ +/* get_enviroment.c :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2025/02/04 16:15:05 by whaffman #+# #+# */ +/* Updated: 2025/02/04 16:15:10 by whaffman ######## odam.nl */ +/* */ +/* ************************************************************************** */ -char *get_enviroment(t_enviroment *enviroment, char *name) +#include "minishell.h" + +char *get_enviroment(t_enviroment *enviroment, char *name) { - while (enviroment != NULL) - { - if (ft_strcmp(enviroment->name, name) == 0) - { - return enviroment->value; - } - enviroment = enviroment->next; - } - return NULL; + while (enviroment != NULL) + { + if (ft_strcmp(enviroment->name, name) == 0) + { + return (enviroment->value); + } + enviroment = enviroment->next; + } + return (NULL); } diff --git a/src/enviroment/print_enviroment.c b/src/enviroment/print_enviroment.c index f3fdac3..fab5b22 100644 --- a/src/enviroment/print_enviroment.c +++ b/src/enviroment/print_enviroment.c @@ -1,5 +1,16 @@ -#include "enviroment.h" -#include +/* ************************************************************************** */ +/* */ +/* :::::::: */ +/* print_enviroment.c :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2025/02/04 16:13:04 by whaffman #+# #+# */ +/* Updated: 2025/02/04 16:15:52 by whaffman ######## odam.nl */ +/* */ +/* ************************************************************************** */ + +#include "minishell.h" void print_enviroment(t_enviroment *enviroment) { diff --git a/src/prompt.c b/src/prompt.c index 5f32aed..689d4eb 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* :::::::: */ +/* prompt.c :+: :+: */ +/* +:+ */ +/* By: whaffman +#+ */ +/* +#+ */ +/* Created: 2025/02/04 16:13:08 by whaffman #+# #+# */ +/* Updated: 2025/02/04 16:13:09 by whaffman ######## odam.nl */ +/* */ +/* ************************************************************************** */ + #include "minishell.h" void print_prompt(void)