forked from unow0517/42_minishell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.c
More file actions
47 lines (42 loc) · 1.55 KB
/
errors.c
File metadata and controls
47 lines (42 loc) · 1.55 KB
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
47
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* errors.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tsimitop <tsimitop@student.42heilbronn. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/29 11:57:39 by tsimitop #+# #+# */
/* Updated: 2024/05/31 10:34:48 by tsimitop ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void file_error(t_command *cmd_node)
{
cmd_node->file_not_found = 1;
ft_putstr_fd("minishell: ", 2);
ft_putstr_fd(cmd_node->filename, 2);
ft_putstr_fd(": ", 2);
perror("");
}
void heredoc_error(t_command *cmd_node)
{
cmd_node->file_not_found = 1;
ft_putstr_fd("minishell: ", 2);
ft_putstr_fd("/tmp/heredoc", 2);
ft_putstr_fd(": ", 2);
perror("");
}
void cmd_error(t_command *cmd_node)
{
ft_putstr_fd("minishell: ", 2);
ft_putstr_fd(cmd_node->cmd, 2);
ft_putstr_fd(": command not found\n", 2);
exit(127);
}
void env_error(char *cmd)
{
ft_putstr_fd("minishell: ", 2);
ft_putstr_fd(cmd, 2);
ft_putstr_fd(": No such file or directory\n", 2);
exit(127);
}