-
Notifications
You must be signed in to change notification settings - Fork 0
/
errorhandling.c
54 lines (47 loc) · 1.5 KB
/
errorhandling.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
47
48
49
50
51
52
53
54
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* errorhandling.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tsaari <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/29 07:24:34 by tsaari #+# #+# */
/* Updated: 2024/04/06 14:17:41 by tsaari ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
void ft_error_cmd(char *error, char *cmd)
{
write(2, error, ft_strlen(error));
write(2, cmd, ft_strlen(cmd));
write(2, "\n", 1);
}
void ft_error(char *error)
{
write(2, error, ft_strlen(error));
write(2, "\n", 1);
}
void ft_infile_error(char *error, char *arg)
{
write(2, error, ft_strlen(error));
write(2, arg, ft_strlen(arg));
write(2, "\n", 1);
}
void ft_file_error(char *error, char *arg)
{
write(2, error, ft_strlen(error));
write(2, arg, ft_strlen(arg));
write(2, "\n", 1);
}
void ft_free(char **arr)
{
int i;
i = 0;
while (arr[i] != NULL)
{
free(arr[i]);
i++;
}
free(arr);
arr = NULL;
}