| inc | ||
| lib | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .gitmodules | ||
| compile_flags.txt | ||
| en.subject.pdf | ||
| Makefile | ||
| README.md | ||
Minishell
Allowed Functions
<fcntl.h>
openint open(const char *pathname, int flags, ...);- Opens a file specified by pathname. The flags argument determines the file access mode and file status flags.
<dirent.h>
opendirDIR *opendir(const char *name);- Opens a directory stream corresponding to the directory name, and returns a pointer to the directory stream.
readdirstruct dirent *readdir(DIR *dirp);- Reads the next directory entry from the directory stream pointed to by dirp.
closedirint closedir(DIR *dirp);- Closes the directory stream associated with dirp.
<stdlib.h>
mallocvoid *malloc(size_t size);- Allocates size bytes of memory and returns a pointer to the allocated memory.
freevoid free(void *ptr);- Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc.
<stdio.h>
printfint printf(const char *format, ...);- Sends formatted output to stdout.
<sys/stat.h>
statint stat(const char *pathname, struct stat *statbuf);- Retrieves information about the file pointed to by pathname and fills in the stat structure.
lstatint lstat(const char *pathname, struct stat *statbuf);- Similar to stat, but does not follow symbolic links.
fstatint fstat(int fd, struct stat *statbuf);- Retrieves information about the file referred to by the open file descriptor fd.
<sys/wait.h>
waitpid_t wait(int *wstatus);- Suspends execution of the calling process until one of its children terminates.
waitpidpid_t waitpid(pid_t pid, int *wstatus, int options);- Suspends execution of the calling process until the child specified by pid changes state.
wait3pid_t wait3(int *wstatus, int options, struct rusage *rusage);- Similar to wait, but also returns resource usage information.
wait4pid_t wait4(pid_t pid, int *wstatus, int options, struct rusage *rusage);- Similar to waitpid, but also returns resource usage information.
<signal.h>
signalvoid (*signal(int signum, void (*handler)(int)))(int);- Sets a function to handle signal signum.
sigactionint sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);- Examines and changes the action associated with a specific signal.
sigemptysetint sigemptyset(sigset_t *set);- Initializes the signal set pointed to by set to exclude all signals.
sigaddsetint sigaddset(sigset_t *set, int signum);- Adds the individual signal specified by signum to the signal set pointed to by set.
killint kill(pid_t pid, int sig);- Sends the signal sig to the process specified by pid.
<unistd.h>
writessize_t write(int fd, const void *buf, size_t count);- Writes up to count bytes from the buffer starting at buf to the file referred to by the file descriptor fd.
accessint access(const char *pathname, int mode);- Checks the file named by pathname for accessibility according to the bit pattern contained in mode.
readssize_t read(int fd, void *buf, size_t count);- Reads up to count bytes from file descriptor fd into the buffer starting at buf.
closeint close(int fd);q- Closes the file descriptor fd.
forkpid_t fork(void);- Creates a new process by duplicating the calling process.
<readline/readline.h>
readlinechar *readline(const char *prompt);- Reads a line from the terminal with editing capabilities.
rl_clear_historyvoid rl_clear_history(void);- Clears the history of lines read by readline.
rl_on_new_lineint rl_on_new_line(void);- Resets the state to indicate that a new line of input is being read.
rl_replace_lineint rl_replace_line(const char *text, int clear_undo);- Replaces the contents of the current line with text.
rl_redisplayint rl_redisplay(void);- Redisplays the current input line.
add_historyvoid add_history(const char *line);- Adds the line to the history list.
<termios.h>
tcsetattrint tcsetattr(int fd, int optional_actions, const struct termios *termios_p);- Sets the parameters associated with the terminal referred to by fd.
tcgetattrint tcgetattr(int fd, struct termios *termios_p);- Gets the parameters associated with the terminal referred to by fd.
<term.h>
tgetentint tgetent(char *bp, const char *name);- Loads the entry for name from the termcap database.
tgetflagint tgetflag(const char *id);- Gets the boolean entry for id from the termcap database.
tgetnumint tgetnum(const char *id);- Gets the numeric entry for id from the termcap database.
tgetstrchar *tgetstr(const char *id, char **area);- Gets the string entry for id from the termcap database.
tgotochar *tgoto(const char *cap, int col, int row);- Returns a cursor addressing string for the given capability cap.
tputsint tputs(const char *str, int affcnt, int (*putc)(int));- Outputs the string str with padding.