-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundled_funcs.c
46 lines (42 loc) · 1016 Bytes
/
bundled_funcs.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "shell.h"
/**
* get_path_args - get absolute path for program name
* @program: program token
* Return: absolute path
*/
char *get_path_args(char *program)
{
char *tmp;
char *tmp_env;
char **tmp_args;
tmp = _find_env_get_value("PATH");
/* printf("%s\n", tmp); */
tmp_env = _stralloc(1, tmp);
tmp_args = tokeniser(&tmp_env, ":");
/* printf("[%s]\n", tmp_args[1]); */
tmp = _find_x_path(tmp_args, program);
/* printf("tmp[%s]a1[]a2[]\n", tmp); */
free(tmp_env);
free(tmp_args);
return (tmp);
}
/**
* generate_prompt_line - display prompt
* @custom: custom prompt
* Return: prompt string in color
*/
char *generate_prompt_line(char *custom)
{
char buff[1024];
if (custom == NULL)
custom = "";
return (_stralloc(21,
_BOLD_, _COLOR_MAGENTA_, custom, _CLEAR_,
" | ",
_COLOR_MAGENTA_, "Raid55", _CLEAR_,
_BOLD_, _COLOR_GREEN_, "@", _CLEAR_,
_BOLD_, _COLOR_YELLOW_, _find_env_get_value("USER"), _CLEAR_,
":",
_COLOR_CYAN_, getcwd(buff, 1024), _CLEAR_,
"$ "));
}