Skip to content

Axow01/minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minishell

Description

Minishell is a project that aims to create a simple shell.

Usage

make
./minishell

Norm

  • Optimised variables types. ex: int8_t instead of int.
  • Variables & functions names : lowercase and snake_case.
  • Variables names: logical and explicit.
  • Use libmms for memory management.
  • Logical names at all times.

How to push

  • Never push directly on master.
  • Create branch for your edits.
  • After your edits, fetch and merge to master.
  • Push.
alias sgit=git fetch --all && git pull --all && git branch
alias submodule=git submodule update --init
sgit && submodule
git branch <branch_name>
git switch <branch_name>

merge to master:

git add .
git commit -m "<message>"
git switch master
sgit
git merge <branch_name>
git push

push branch:

git add .
git commit -m "<message>"
git push <branch_name>

Delete branch:

git branch -D <branch_name>

Functions Documentation

Function Description
readline Reads a line from standard input and returns it as a dynamically allocated string. It provides line editing and command history.
rl_clear_history Clears the command history maintained by readline.
rl_on_new_line Informs readline that the cursor has moved to a new line.
rl_replace_line Replaces the current line displayed by readline with a new line.
rl_redisplay Updates the display after changes made by rl_replace_line.
add_history Adds a line to the command history maintained by readline.
printf Prints formatted output to the standard output stream.
malloc Allocates a block of memory on the heap.
free Releases previously allocated memory back to the heap.
write Writes data to a file descriptor.
access Checks if a file can be accessed with specified permissions.
open Opens a file and returns a file descriptor.
read Reads data from a file descriptor into a buffer.
close Closes a file descriptor.
fork Creates a new process by duplicating the existing process.
wait Suspends execution of the calling process until a child process terminates.
waitpid Suspends execution of the calling process until a specific child process terminates.
wait3 Suspends execution of the calling process until a child process terminates and provides process resource usage information.
wait4 Suspends execution of the calling process until a specific child process terminates and provides process resource usage information.
signal Sets a signal handler for a specific signal.
sigaction Examines and modifies the action associated with a specific signal.
sigemptyset Initializes an empty signal set.
sigaddset Adds a signal to a signal set.
kill Sends a signal to a process or a group of processes.
exit Terminates the calling process and returns an exit status to the parent process.
getcwd Retrieves the current working directory.
chdir Changes the current working directory.
stat Retrieves information about a file.
lstat Retrieves information about a file (does not follow symbolic links).
fstat Retrieves information about a file from a file descriptor.
unlink Removes a specified file from the file system.
execve Replaces the current process image with a new process image.
dup Duplicates a file descriptor.
dup2 Duplicates a file descriptor and replaces an existing file descriptor with it.
pipe Creates a pipe, a unidirectional data channel, between two file descriptors.
opendir Opens a directory stream.
readdir Reads a directory entry from a directory stream.
closedir Closes a directory stream.
strerror Returns a string describing the given error code.
perror Prints an error message to the standard error stream.
isatty Tests whether a file descriptor refers to a terminal.
ttyname Returns the name of the terminal associated with a file descriptor.
ttyslot Returns the number of the slot in the terminal table associated with a file descriptor.
ioctl Performs device-specific operations on file descriptors.
getenv Retrieves the value of an environment variable.
tcsetattr Sets the attributes of a terminal device.
tcgetattr Retrieves the attributes of a terminal device.
tgetent Initializes the terminfo database.
tgetflag Retrieves the value of a Boolean capability from the terminfo database.
tgetnum Retrieves the value of a numeric capability from the terminfo database.
tgetstr Retrieves the value of a string capability from the terminfo database.
tgoto Translates the given parameters to cursor motion string using the capabilities from the terminfo database.
tputs Outputs the given string to the terminal using the capabilities from the terminfo database.