-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.c
More file actions
43 lines (38 loc) · 1.58 KB
/
Copy patherror.c
File metadata and controls
43 lines (38 loc) · 1.58 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tbui-quo <tbui-quo@student.42wolfsburg.d> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/12 19:06:42 by tbui-quo #+# #+# */
/* Updated: 2023/06/12 19:06:42 by tbui-quo ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
int print_error_msg(char *error)
{
write(STDERR_FILENO, error, ft_strlen(error));
return (1);
}
void print_error_cmd_not_found_and_exit(char *split_cmd, char *error)
{
ft_putstr_fd(error, STDERR_FILENO);
ft_putstr_fd(split_cmd, STDERR_FILENO);
ft_putstr_fd(": command not found", STDERR_FILENO);
ft_putstr_fd("\n", STDERR_FILENO);
exit(127);
}
void print_error_open_file_and_exit(char *filename, char *error)
{
ft_putstr_fd(error, STDERR_FILENO);
ft_putstr_fd(filename, STDERR_FILENO);
ft_putstr_fd(": No such file or directory", STDERR_FILENO);
ft_putstr_fd("\n", STDERR_FILENO);
exit (EXIT_FAILURE);
}
void print_error_msg_and_exit(char *error)
{
perror(error);
exit (EXIT_FAILURE);
}