added inc/minishell.h

This commit is contained in:
whaffman 2025-02-01 00:41:21 +01:00
parent b967096652
commit 8aed9ed592

166
inc/minishell.h Normal file
View File

@ -0,0 +1,166 @@
/**
* @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 <stdio.h>
* - printf(const char *format, ...);
* - Prints formatted data to stdout.
* - perror(const char *s);
* - Prints a descriptive error message to stderr.
*
* @headerfile <stdlib.h>
* - malloc(size_t size);
* - Allocates memory dynamically.
* - free(void *ptr);
* - Frees dynamically allocated memory.
* - exit(int status);
* - Terminates the calling process.
* - getenv(const char *name);
* - Retrieves the value of an environment variable.
*
* @headerfile <unistd.h>
* - write(int fd, const void *buf, size_t count);
* - Writes data to a file descriptor.
* - access(const char *pathname, int mode);
* - Checks user's permissions for a file.
* - read(int fd, void *buf, size_t count);
* - Reads data from a file descriptor.
* - close(int fd);
* - Closes a file descriptor.
* - fork(void);
* - Creates a new process.
* - getcwd(char *buf, size_t size);
* - Gets the current working directory.
* - chdir(const char *path);
* - Changes the current working directory.
* - unlink(const char *pathname);
* - Deletes a name from the filesystem.
* - execve(const char *pathname, char *const argv[], char *const envp[]);
* - Executes a program.
* - dup(int oldfd);
* - Duplicates a file descriptor.
* - dup2(int oldfd, int newfd);
* - Duplicates a file descriptor to a specific descriptor number.
* - pipe(int pipefd[2]);
* - Creates a pipe.
* - isatty(int fd);
* - Checks if a file descriptor refers to a terminal.
* - ttyname(int fd);
* - Returns the name of the terminal associated with a file descriptor.
* - ttyslot(void);
* - Returns the index of the current terminal.
*
* @headerfile <string.h>
* - 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>
* - wait(int *wstatus);
* - Waits for a child process to change state.
* - waitpid(pid_t pid, int *wstatus, int options);
* - Waits for a specific child process to change state.
* - wait3(int *wstatus, int options, struct rusage *rusage);
* - Waits for a child process to change state with resource usage information.
* - 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>
* - open(const char *pathname, int flags, ...);
* - Opens a file.
*
* @headerfile <errno.h>
* - Provides access to the errno variable.
*
* @headerfile <signal.h>
* - signal(int signum, void (*handler)(int));
* - Sets a signal handler.
* - sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
* - Examines and changes a signal action.
* - sigemptyset(sigset_t *set);
* - Initializes a signal set to empty.
* - sigaddset(sigset_t *set, int signum);
* - Adds a signal to a signal set.
* - kill(pid_t pid, int sig);
* - Sends a signal to a process.
*
* @headerfile <readline/readline.h>
* - readline(const char *prompt);
* - Reads a line of input from the user.
* - rl_clear_history(void);
* - Clears the history list.
* - rl_on_new_line(void);
* - Informs the readline library that the cursor is on a new line.
* - rl_replace_line(const char *text, int clear_undo);
* - Replaces the contents of the current line.
* - rl_redisplay(void);
* - Redisplays the current line.
* - add_history(const char *line);
* - Adds a line to the history list.
*
* @headerfile <dirent.h>
* - opendir(const char *name);
* - Opens a directory stream.
* - readdir(DIR *dirp);
* - Reads a directory entry.
* - closedir(DIR *dirp);
* - Closes a directory stream.
*
* @headerfile <sys/stat.h>
* - stat(const char *pathname, struct stat *statbuf);
* - Gets file status.
* - lstat(const char *pathname, struct stat *statbuf);
* - Gets file status, not following symbolic links.
* - fstat(int fd, struct stat *statbuf);
* - Gets file status for an open file descriptor.
*
* @headerfile <sys/ioctl.h>
* - ioctl(int fd, unsigned long request, ...);
* - Manipulates the underlying device parameters of special files.
*
* @headerfile <termios.h>
* - tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
* - Sets the parameters associated with the terminal.
* - tcgetattr(int fd, struct termios *termios_p);
* - Gets the parameters associated with the terminal.
*
* @headerfile <term.h>
* - tgetent(char *bp, const char *name);
* - Loads the terminal entry for a given terminal name.
* - tgetflag(const char *id);
* - Gets the boolean value of a terminal capability.
* - tgetnum(const char *id);
* - Gets the numeric value of a terminal capability.
* - tgetstr(const char *id, char **area);
* - Gets the string value of a terminal capability.
* - tgoto(const char *cap, int col, int row);
* - Computes a cursor movement string.
* - tputs(const char *str, int affcnt, int (*putc)(int));
* - Outputs a string with padding.
*/
#ifndef MINISHELL_H
# define MINISHELL_H
# include <stdio.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 <readline/readline.h>
# include <dirent.h>
# include <sys/stat.h>
# include <sys/ioctl.h>
# include <termios.h>
# include <term.h>
#endif // MINISHELL_H