GCC Code Coverage Report


Directory: ./
File: src/prompt/title.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 0 12 0.0%
Functions: 0 1 0.0%
Branches: 0 6 0.0%

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