minishell | Create a simple shell
kandi X-RAY | minishell Summary
kandi X-RAY | minishell Summary
minishell is a C library. minishell has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.
#fork L'appel système fork permet le création d'un processus clône du processus courrant. pid_t fork(void); DEUX valeurs de retour en cas de succès: Dans le processus père valeur de retour = le PID du fils. A recuperer?? Dans le processus fils valeur de retour = zéro. Sinon Dans le processus père valeur de retour = -1. #wait pid_t wait(int *ptr_etat) Le processus pere attend son fils. Donne comme valeur de retour le pid du fils qui a terminé, et le code de fin est stocké dans ptr_etat. A recuperer &ptr_etat. #waitpid On peut également attendre la fin du fils grâce à son pid : pid_t waitpid(pid_t pid, int *ptr_etat, int options). #exit prend un etat/status en parametre -> exit le processus. #dup int dup(int oldfd); int dup2(int oldfd, int newfd); Créent une copie du descripteur de fichier oldfd. #signal signal() installe le gestionnaire handler pour le signal signum. handler peut être SIG_IGN, SIG_DFL ou l'adresse d'une fonction définie par le programmeur (un « gestionnaire de signal »). La fonction signal permet de spécifier ou de connaître le comportement du processus à la réception d'un signal donné, il faut donner en paramètre à la fonction le numéro du signal sig que l'on veut détourner et la fonction de traitement action à réaliser à la réception du signal. #getcwd The getcwd() function copies the absolute pathname of the current working directory into the memory referenced by buf and returns a pointer to buf. The size argument is the size, in bytes, of the array referenced by buf. If buf is NULL, space is allocated as necessary to store the pathname and size is ignored. -> MALLOC tout seul, pas de size necessaire. #Background, foreground Ctrl-Z - processus en background - fg pour le ramener en foreground. On peut voir les numéros de job a gauche entre []. Ctrl -C tells the terminal to send a SIGINT to the current foreground process, which by default translates into terminating the application. Ctrl -D tells the terminal that it should register a EOF on standard input, which bash interprets as a desire to exit. Ctrl -D means end of file. It only works at the beginning of a line (I'm simplifying a little), and has no effect if the program isn't reading input from the terminal. In your experiment, ^D told the shell that you weren't going to type any more commands, so it exited; then the terminal exited because its subprogram had terminated. -> ctrl-D n'est pas un signal, mais un retour de read. Ctrl -\ : This sends the QUIT signal, which by default terminates an application. #dirent.h DIR : type representing a directory stream : rdered sequence of all the directory entries in a particular directory. char d_name[] : name of an entry struct dirent * > returned by readdir. The readdir() function returns a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and positions the directory stream at the next entry. It returns a null pointer upon reaching the end of the directory stream. The structure dirent defined by the dirent.h header describes a directory entry. opendir : The opendir() function opens a directory stream corresponding to the directory named by the dirname argument. The directory stream is positioned at the first entry. Upon successful completion, opendir() returns a pointer to an object of type DIR. Otherwise, a null pointer is returned and errno is set to indicate the error. #stat retourne un struct stat *buf, le remplit avec plusieurs champ, donc un champ st_mode, qui se compare avec des valeurs ENUM comme un flagbit -> permet de connaitre les droits. The pipe() function creates a pipe (an object that allows unidirectional data flow) and allocates a pair of file descriptors. The first descriptor connects to the read end of the pipe; the second connects to the write end. Data written to fildes[1] appears on (i.e., can be read from) fildes[0]. #dup, dup2, dup() duplicates an existing object descriptor and returns its value to the calling process (fildes2 = dup(fildes)) In dup2(), the value of the new descriptor fildes2 is specified. If fildes and fildes2 are equal, then dup2() just returns fildes2; no other changes are made to the existing descriptor. Infos pipes :
#fork L'appel système fork permet le création d'un processus clône du processus courrant. pid_t fork(void); DEUX valeurs de retour en cas de succès: Dans le processus père valeur de retour = le PID du fils. A recuperer?? Dans le processus fils valeur de retour = zéro. Sinon Dans le processus père valeur de retour = -1. #wait pid_t wait(int *ptr_etat) Le processus pere attend son fils. Donne comme valeur de retour le pid du fils qui a terminé, et le code de fin est stocké dans ptr_etat. A recuperer &ptr_etat. #waitpid On peut également attendre la fin du fils grâce à son pid : pid_t waitpid(pid_t pid, int *ptr_etat, int options). #exit prend un etat/status en parametre -> exit le processus. #dup int dup(int oldfd); int dup2(int oldfd, int newfd); Créent une copie du descripteur de fichier oldfd. #signal signal() installe le gestionnaire handler pour le signal signum. handler peut être SIG_IGN, SIG_DFL ou l'adresse d'une fonction définie par le programmeur (un « gestionnaire de signal »). La fonction signal permet de spécifier ou de connaître le comportement du processus à la réception d'un signal donné, il faut donner en paramètre à la fonction le numéro du signal sig que l'on veut détourner et la fonction de traitement action à réaliser à la réception du signal. #getcwd The getcwd() function copies the absolute pathname of the current working directory into the memory referenced by buf and returns a pointer to buf. The size argument is the size, in bytes, of the array referenced by buf. If buf is NULL, space is allocated as necessary to store the pathname and size is ignored. -> MALLOC tout seul, pas de size necessaire. #Background, foreground Ctrl-Z - processus en background - fg pour le ramener en foreground. On peut voir les numéros de job a gauche entre []. Ctrl -C tells the terminal to send a SIGINT to the current foreground process, which by default translates into terminating the application. Ctrl -D tells the terminal that it should register a EOF on standard input, which bash interprets as a desire to exit. Ctrl -D means end of file. It only works at the beginning of a line (I'm simplifying a little), and has no effect if the program isn't reading input from the terminal. In your experiment, ^D told the shell that you weren't going to type any more commands, so it exited; then the terminal exited because its subprogram had terminated. -> ctrl-D n'est pas un signal, mais un retour de read. Ctrl -\ : This sends the QUIT signal, which by default terminates an application. #dirent.h DIR : type representing a directory stream : rdered sequence of all the directory entries in a particular directory. char d_name[] : name of an entry struct dirent * > returned by readdir. The readdir() function returns a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and positions the directory stream at the next entry. It returns a null pointer upon reaching the end of the directory stream. The structure dirent defined by the dirent.h header describes a directory entry. opendir : The opendir() function opens a directory stream corresponding to the directory named by the dirname argument. The directory stream is positioned at the first entry. Upon successful completion, opendir() returns a pointer to an object of type DIR. Otherwise, a null pointer is returned and errno is set to indicate the error. #stat retourne un struct stat *buf, le remplit avec plusieurs champ, donc un champ st_mode, qui se compare avec des valeurs ENUM comme un flagbit -> permet de connaitre les droits. The pipe() function creates a pipe (an object that allows unidirectional data flow) and allocates a pair of file descriptors. The first descriptor connects to the read end of the pipe; the second connects to the write end. Data written to fildes[1] appears on (i.e., can be read from) fildes[0]. #dup, dup2, dup() duplicates an existing object descriptor and returns its value to the calling process (fildes2 = dup(fildes)) In dup2(), the value of the new descriptor fildes2 is specified. If fildes and fildes2 are equal, then dup2() just returns fildes2; no other changes are made to the existing descriptor. Infos pipes :
Support
Quality
Security
License
Reuse
Support
minishell has a low active ecosystem.
It has 1 star(s) with 0 fork(s). There are 1 watchers for this library.
It had no major release in the last 6 months.
minishell has no issues reported. There are no pull requests.
It has a neutral sentiment in the developer community.
The latest version of minishell is current.
Quality
minishell has no bugs reported.
Security
minishell has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
License
minishell does not have a standard license declared.
Check the repository for any license declaration and review the terms closely.
Without a license, all rights are reserved, and you cannot use the library in your applications.
Reuse
minishell releases are not available. You will need to build from source code and install.
Installation instructions are not available. Examples and code snippets are available.
Top functions reviewed by kandi - BETA
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of minishell
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of minishell
minishell Key Features
No Key Features are available at this moment for minishell.
minishell Examples and Code Snippets
No Code Snippets are available at this moment for minishell.
Community Discussions
No Community Discussions are available at this moment for minishell.Refer to stack overflow page for discussions.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install minishell
You can download it from GitHub.
Support
For any new features, suggestions and bugs create an issue on GitHub.
If you have any questions check and ask questions on community page Stack Overflow .
Find more information at:
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page