| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2024 | ||
| 3 | ** Shell | ||
| 4 | ** File description: | ||
| 5 | ** title.c | ||
| 6 | */ | ||
| 7 | /** | ||
| 8 | * @file title.c | ||
| 9 | * @brief The file containing the title function | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include "../../include/myshell.h" | ||
| 13 | |||
| 14 | /** | ||
| 15 | * @brief Set the title of the shell | ||
| 16 | * @return <b>void</b> | ||
| 17 | */ | ||
| 18 | ✗ | void set_title(void) | |
| 19 | { | ||
| 20 | char **tab; | ||
| 21 | char *current_pwd; | ||
| 22 | char *current_directory; | ||
| 23 | |||
| 24 | ✗ | current_pwd = getcwd(NULL, 0); | |
| 25 | ✗ | tab = my_str_to_word_array_select(current_pwd, "/"); | |
| 26 | ✗ | if (tab[0] == NULL) | |
| 27 | ✗ | my_printf("\033]0;🧠root ðŸ§\a"); | |
| 28 | ✗ | for (int i = 0; tab[i] != NULL; i++) { | |
| 29 | ✗ | current_directory = tab[i]; | |
| 30 | ✗ | if (tab[i + 1] == NULL) | |
| 31 | ✗ | my_printf("\033]0;🧠%s ðŸ§\a", current_directory); | |
| 32 | } | ||
| 33 | ✗ | my_free_array((void *)tab); | |
| 34 | ✗ | free(current_pwd); | |
| 35 | ✗ | } | |
| 36 |