diff --git a/README.md b/README.md index 4da7a9c..0e22f61 100644 --- a/README.md +++ b/README.md @@ -1,81 +1,82 @@ -## external functions : +## 2. external functions : --- ### readline : -- readline -- rl_clear_history -- rl_on_new_line -- rl_replace_line -- rl_redisplay -- add_history +- **readline** : `char *readline (const char *prompt);` will read a line from the terminal and return it, using prompt as a prompt +- **rl_clear_history** : ` ` +- **rl_on_new_line** : ` ` +- **rl_replace_line** : ` ` +- **rl_redisplay** : ` ` +- **add_history** : ` ` ### files : -- access -- open -- read -- close -- dup -- dup2 -- pipe -- stat : `int stat(const char *pathname, struct stat *statbuf);` returns information about a file, in the buffer pointed to by statbuf -- lstat : `int fstat(int fd, struct stat *statbuf);` lstat() is identical to stat(), except that if pathname is a symbolic link, then it returns information about the link itself, not the file that it refers to -- fstat : `int lstat(const char *pathname, struct stat *statbuf);` fstat() is identical to stat(), except that the file about which information is to be retrieved is specified by the file descriptor fd -- unlink : `int unlink(const char *pathname);` unlink() deletes a name from the filesystem +- **access** : `int access(const char *pathname, int mode);` checks whether the calling process can access the file pathname +- **open** : `int open(const char *pathname, int flags, [mode_t mode]);` system call opens the file specified by pathname +- **read** : `ssize_t read(int fd, void *buf, size_t count);` attempts to read up to count bytes from file descriptor fd into the buffer starting at buf +- **close** : `int close(int fd);` closes a file descriptor, so that it no longer refers to any file and may be reused +- **dup** : `int dup(int oldfd);` creates a copy of the file descriptor oldfd, using the lowest-numbered unused file descriptor for the new descriptor +- **dup2** : `int dup2(int oldfd, int newfd);` performs the same task as dup(), but instead of using the lowest-numbered unused file descriptor, it uses the file descriptor number specified in newfd +- **pipe** : `int pipe(int pipefd[2]);` creates a pipe, a unidirectional data channel that can be used for interprocess communication. The array pipefd is used to return two file descriptors referring to the ends of the pipe. pipefd[0] refers to the read end of the pipe. pipefd[1] refers to the write end of the pipe +- **stat** : `int stat(const char *pathname, struct stat *statbuf);` returns information about a file, in the buffer pointed to by statbuf +- **lstat** : `int fstat(int fd, struct stat *statbuf);` lstat() is identical to stat(), except that if pathname is a symbolic link, then it returns information about the link itself, not the file that it refers to +- **fstat** : `int lstat(const char *pathname, struct stat *statbuf);` fstat() is identical to stat(), except that the file about which information is to be retrieved is specified by the file descriptor fd +- **unlink** : `int unlink(const char *pathname);` unlink() deletes a name from the filesystem ### process : -- fork -- wait -- waitpid -- wait3 -- wait4 -- exit +- **fork** : ` ` +- **wait** : ` ` +- **waitpid** : ` ` +- **wait3** : ` ` +- **wait4** : ` ` +- **exit** : ` ` ### signals : -- signal -- sigaction -- kill +- **signal** : ` ` +- **sigaction** : ` ` +- **kill** : ` ` ### directories : -- getcwd : `char *getcwd(char *buf, size_t size);` returns a null-terminated string containing an absolute pathname that is the current working directory of the calling process -- chdir : `int chdir(const char *path);` changes the current working directory of the calling process to the directory specified in path -- execve : `int execve(const char *filename, char *const argv[], char *const envp[]);` executes the program pointed to by filename -- opendir : `DIR *opendir(const char *name);` opens a directory stream corresponding to the directory name, and returns a pointer to the directory stream -- readdir : `struct dirent *readdir(DIR *dirp);` returns a pointer to a dirent structure representing the next directory entry in the directory stream pointed to by dirp -- closedir : `int closedir(DIR *dirp);` closes the directory stream associated with dirp +- **getcwd** : `char *getcwd(char *buf, size_t size);` returns a null-terminated string containing an absolute pathname that is the current working directory of the calling process +- **chdir** : `int chdir(const char *path);` changes the current working directory of the calling process to the directory specified in path +- **execve** : `int execve(const char *filename, char *const argv[], char *const envp[]);` executes the program pointed to by filename +- **opendir** : `DIR *opendir(const char *name);` opens a directory stream corresponding to the directory name, and returns a pointer to the directory stream +- **readdir** : `struct dirent *readdir(DIR *dirp);` returns a pointer to a dirent structure representing the next directory entry in the directory stream pointed to by dirp +- **closedir** : `int closedir(DIR *dirp);` closes the directory stream associated with dirp ### errors : -- strerror : `char *strerror(int errnum);` returns a pointer to a string that describes the error code passed in the argument errnum -- perror : `void perror(const char *s);` produces a message on standard error describing the last error encountered during a call to a system or library function +- **strerror** : `char *strerror(int errnum);` returns a pointer to a string that describes the error code passed in the argument errnum +- **perror** : `void perror(const char *s);` produces a message on standard error describing the last error encountered during a call to a system or library function ### other : -- printf -- malloc -- free -- write +- **printf** : ` ` +- **malloc** : ` ` +- **free** : ` ` +- **write** : ` ` -- isatty -- ttyname -- ttyslot -- ioctl -- getenv -- tcsetattr -- tcgetattr -- tgetent -- tgetflag -- tgetnum -- tgetstr -- tgoto -- tputs +- **isatty** : ` ` +- **ttyname** : ` ` +- **ttyslot** : ` ` +- **ioctl** : ` ` +- **getenv** : ` ` +- **tcsetattr** : ` ` +- **tcgetattr** : ` ` +- **tgetent** : ` ` +- **tgetflag** : ` ` +- **tgetnum** : ` ` +- **tgetstr** : ` ` +- **tgoto** : ` ` +- **tputs** : ` ` ## sommaire : --- - [1. todo list :](#markdown-header-1-todo-list) -- [2. parsing :](#markdown-header-2-parsing) - - [2.1. methode arbre binaire :](#markdown-header-21-methode-arbre-binaire) -- [3. gerer les quotes et la separation des arguments :](#markdown-header-3-gerer-les-quotes-et-la-separation-des-arguments) - - [3.1. tentative methode 1 :](#markdown-header-31-tentative-methode-1) - - [3.1.1. pseudo code :](#markdown-header-311-pseudo-code) - - [3.1.2. application :](#markdown-header-312-application) - - [3.1.3. erreur :](#markdown-header-313-erreur) - - [3.2. tentative methode 2 :](#markdown-header-32-tentative-methode-2) - - [3.2.1. deroulement :](#markdown-header-321-deroulement) - - [3.2.2. application :](#markdown-header-322-application) - - [3.3. comportement reel chelou :](#markdown-header-33-comportement-reel-chelou) -- [4. notes :](#markdown-header-4-notes) +- [2. external functions :](#markdown-header-2-external-functions) +- [3. parsing :](#markdown-header-3-parsing) + - [3.1. methode arbre binaire :](#markdown-header-31-methode-arbre-binaire) +- [4. gerer les quotes et la separation des arguments :](#markdown-header-4-gerer-les-quotes-et-la-separation-des-arguments) + - [4.1. tentative methode 1 :](#markdown-header-41-tentative-methode-1) + - [4.1.1. pseudo code :](#markdown-header-411-pseudo-code) + - [4.1.2. application :](#markdown-header-412-application) + - [4.1.3. erreur :](#markdown-header-413-erreur) + - [4.2. tentative methode 2 :](#markdown-header-42-tentative-methode-2) + - [4.2.1. deroulement :](#markdown-header-421-deroulement) + - [4.2.2. application :](#markdown-header-422-application) + - [4.3. comportement reel chelou :](#markdown-header-43-comportement-reel-chelou) +- [5. notes :](#markdown-header-5-notes) ## 1. todo list : --- @@ -119,10 +120,10 @@ *[\go to sommaire](#markdown-header-sommaire)* -## 2. parsing : +## 3. parsing : --- -### 2.1 methode arbre binaire : +### 3.1 methode arbre binaire : [transformer arbre normal en arbre binaire](https://fr.wikipedia.org/wiki/Arbre_binaire#Transformation_d'un_arbre_quelconque_en_un_arbre_binaire) @@ -156,12 +157,12 @@ EXEMPLE : . . *[\go to sommaire](#markdown-header-sommaire)* -## 3. gerer les quotes et la separation des arguments : +## 4. gerer les quotes et la separation des arguments : --- -### 3.1 tentative methode 1 : +### 4.1 tentative methode 1 : -#### 3.1.1 pseudo code : +#### 4.1.1 pseudo code : ```text q = 0 // first quote c = 0 // count @@ -210,7 +211,7 @@ while (str[i]) *[\go to sommaire](#markdown-header-sommaire)* -#### 3.1.2 application : +#### 4.1.2 application : ```text ['][a][r][g][1][ ]['][a][r][g][2]["][ ][a][r][g][3]["] c = 0 . . . . . . . . . . . . . . . . . . @@ -253,7 +254,7 @@ c = . . . . . . . . . 0 str[i] != ' | " ; -> *[\go to sommaire](#markdown-header-sommaire)* -#### 3.1.3 erreur : +#### 4.1.3 erreur : -> comment le programme sait que cette fois il doit decrementer "c" ? en retenant dans l'ordre toutes les dernieres valeurs de "q" ! @@ -261,9 +262,9 @@ c = . . . . . . . . . 0 str[i] != ' | " ; -> *[\go to sommaire](#markdown-header-sommaire)* -### 3.2 tentative methode 2 : +### 4.2 tentative methode 2 : -#### 3.2.1 deroulement : +#### 4.2.1 deroulement : ```text .--------------------------------------------. : .--------------------------------------. : @@ -291,7 +292,7 @@ c = . . . . . . . . . 0 str[i] != ' | " ; -> *[\go to sommaire](#markdown-header-sommaire)* -#### 3.2.2 application : +#### 4.2.2 application : ```text .--. 1 : '__"__'__"__"__"__'__'__"__"__'__'__"__'__"__' @@ -321,7 +322,7 @@ c = . . . . . . . . . 0 str[i] != ' | " ; -> *[\go to sommaire](#markdown-header-sommaire)* -### 3.3 comportement reel chelou : +### 4.3 comportement reel chelou : ```text echo "_" _ @@ -366,7 +367,7 @@ _'___"___'___"_"___'___"___'_ *[\go to sommaire](#markdown-header-sommaire)* -## 4. notes : +## 5. notes : --- Ordre Interpreteur :