added codam header

This commit is contained in:
whaffman 2025-02-04 16:17:05 +01:00
parent 6179a227cd
commit b67f3a20ab
7 changed files with 95 additions and 194 deletions

View File

@ -1,12 +1,12 @@
# **************************************************************************** # # **************************************************************************** #
# # # #
# ::: o_ :::::: ::: # # :::::::: #
# Makefile :+: / :+::+: :+: # # Makefile :+: :+: #
# +:+ > +:++:+ +:+ # # +:+ #
# By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ # # By: whaffman <whaffman@student.codam.nl> +#+ #
# +#+ +#+#+ +#++#+ +#+ \o/ # # +#+ #
# Created: 2024/10/15 11:48:46 by whaffman #+#+# #+#+# #+# #+# | # # Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
# Updated: 2024/11/07 15:28:08 by whaffman ### ### ### ### / \ # # Updated: 2025/02/04 16:13:00 by whaffman ######## odam.nl #
# # # #
# **************************************************************************** # # **************************************************************************** #

View File

@ -1,170 +1,19 @@
/** /* ************************************************************************** */
* @file minishell.h /* */
* /* :::::::: */
* @brief Header file for the Minishell project. /* minishell.h :+: :+: */
* /* +:+ */
* This header file includes all necessary libraries and headers required for the Minishell project. /* By: whaffman <whaffman@student.codam.nl> +#+ */
* The following is a list of included headers and the functions or system calls they provide: /* +#+ */
* /* Created: 2025/02/04 16:13:13 by whaffman #+# #+# */
* @headerfile <stdio.h> /* Updated: 2025/02/04 16:13:14 by whaffman ######## odam.nl */
* - int printf(const char *format, ...); /* */
* - Prints formatted data to stdout. /* ************************************************************************** */
* - void perror(const char *s);
* - Prints a descriptive error message to stderr.
*
* @headerfile <stdlib.h>
* - 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 <unistd.h>
* - 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 <string.h>
* - char* strerror(int errnum);
* - Returns a string describing the error number.
*
* @headerfile <sys/types.h>
* - Required for various system calls and data types.
*
* @headerfile <sys/wait.h>
* - 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 <fcntl.h>
* - int open(const char *pathname, int flags, ...);
* - Opens a file.
*
* @headerfile <errno.h>
* - Provides access to the errno variable.
*
* @headerfile <signal.h>
* - 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 <readline/readline.h>
* - 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 <dirent.h>
* - 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 <sys/stat.h>
* - 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 <sys/ioctl.h>
* - int ioctl(int fd, unsigned long request, ...);
* - Manipulates the underlying device parameters of special files.
*
* @headerfile <termios.h>
* - 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 <term.h>
* - 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.
*/
#ifndef MINISHELL_H #ifndef MINISHELL_H
# define MINISHELL_H # define MINISHELL_H
# include <stdio.h> # include "allowed.h"
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
# include <sys/types.h>
# include <sys/wait.h>
# include <fcntl.h>
# include <errno.h>
# include <signal.h>
# include <dirent.h>
# include <sys/stat.h>
# include <sys/ioctl.h>
# include <termios.h>
# include <term.h>
# include <readline/readline.h>
# include <readline/history.h>
# include "libft.h" # include "libft.h"
# include "enviroment.h" # include "enviroment.h"

View File

@ -1,8 +1,16 @@
#include "enviroment.h" /* ************************************************************************** */
#include "libft.h" /* */
#include <stdlib.h> /* :::::::: */
#include <stdio.h> /* add_enviroment.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* 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)
{ {

View File

@ -1,6 +1,16 @@
#include "enviroment.h" /* ************************************************************************** */
#include <stdlib.h> /* */
/* :::::::: */
/* free_enviroment.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* 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)
{ {

View File

@ -1,5 +1,16 @@
#include "enviroment.h" /* ************************************************************************** */
#include "libft.h" /* */
/* :::::::: */
/* get_enviroment.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/04 16:15:05 by whaffman #+# #+# */
/* Updated: 2025/02/04 16:15:10 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "minishell.h"
char *get_enviroment(t_enviroment *enviroment, char *name) char *get_enviroment(t_enviroment *enviroment, char *name)
{ {
@ -7,9 +18,9 @@ char *get_enviroment(t_enviroment *enviroment, char *name)
{ {
if (ft_strcmp(enviroment->name, name) == 0) if (ft_strcmp(enviroment->name, name) == 0)
{ {
return enviroment->value; return (enviroment->value);
} }
enviroment = enviroment->next; enviroment = enviroment->next;
} }
return NULL; return (NULL);
} }

View File

@ -1,5 +1,16 @@
#include "enviroment.h" /* ************************************************************************** */
#include <stdio.h> /* */
/* :::::::: */
/* print_enviroment.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* 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) void print_enviroment(t_enviroment *enviroment)
{ {

View File

@ -1,3 +1,15 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* prompt.c :+: :+: */
/* +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/04 16:13:08 by whaffman #+# #+# */
/* Updated: 2025/02/04 16:13:09 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
#include "minishell.h" #include "minishell.h"
void print_prompt(void) void print_prompt(void)