-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_files.c
49 lines (44 loc) · 1.44 KB
/
ft_files.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_files.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yajallal < yajallal@student.1337.ma > +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/09 15:39:58 by yajallal #+# #+# */
/* Updated: 2023/01/13 12:12:05 by yajallal ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_pipex.h"
void ft_checkf(char *file, char *msg, int ex)
{
if (access(file, F_OK) < 0)
{
ft_perror(2, "%s %s", msg, file);
exit(ex);
}
}
void ft_checkw(char *file, int ex)
{
if (access(file, W_OK) < 0)
{
ft_perror(2, "pipex: %s: permission denied\n", file);
exit(ex);
}
}
void ft_checkr(char *file, int ex)
{
if (access(file, R_OK) < 0)
{
ft_perror(2, "pipex: %s: permission denied\n", file);
exit(ex);
}
}
void ft_checkx(char *cmd, int ex)
{
if (access(cmd, X_OK) < 0)
{
ft_perror(2, "pipex: %s: permission denied\n", cmd);
exit(ex);
}
}