-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_error.c
46 lines (41 loc) · 1.38 KB
/
ft_error.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_error.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pbourdon <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/07/18 19:23:35 by pbourdon #+# #+# */
/* Updated: 2016/08/29 18:35:59 by pbourdon ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void ft_putchar_error(char c)
{
write(2, &c, 1);
}
void ft_putstr_error(char *str)
{
int index;
index = 0;
while (str[index] != '\0')
{
ft_putchar_error(str[index]);
index++;
}
}
void ft_error(char *arg, int version)
{
if (version == 1)
{
ft_putstr_error("zsh: command not found: ");
ft_putstr_error(arg);
ft_putchar_error('\n');
}
else if (version == 2)
{
ft_putstr_error("cd: no such file or directory: ");
ft_putstr_error(arg);
ft_putchar_error('\n');
}
}