-
Notifications
You must be signed in to change notification settings - Fork 0
/
hijack_prompt.c
42 lines (39 loc) · 1.62 KB
/
hijack_prompt.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hijack_prompt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mleclair <mleclair@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/05/07 14:34:21 by tgauvrit #+# #+# */
/* Updated: 2017/05/07 18:04:07 by mleclair ### ########.fr */
/* */
/* ************************************************************************** */
#include "chell.h"
t_ssprintf *hijack_prompt(t_env *env)
{
if (env->cond == NULL)
return (ft_sprintf("\e[1;32m%C\e[0;m \e[1;36m%s \e[0m%s",
L'✈', env->dir, PROMPT));
else if (env->cond->type == COND_IF)
return (ft_sprintf(PROMPT_IF));
else if (env->cond->type == COND_WHILE)
return (ft_sprintf(PROMPT_WHILE));
else if (env->cond->type == COND_FOR)
return (ft_sprintf(PROMPT_FOR));
else
return (ft_sprintf(PROMPT_COND));
}
int hijack_prompt_size(t_env *env)
{
if (env->cond == NULL)
return (PROMPT_SIZE);
else if (env->cond->type == COND_IF)
return (PROMPT_SIZE_IF);
else if (env->cond->type == COND_WHILE)
return (PROMPT_SIZE_WHILE);
else if (env->cond->type == COND_FOR)
return (PROMPT_SIZE_FOR);
else
return (PROMPT_SIZE_COND);
}