-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting.c
41 lines (37 loc) · 1.33 KB
/
setting.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* setting.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmoumni <mmoumni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/26 16:44:22 by mmoumni #+# #+# */
/* Updated: 2022/01/02 21:05:22 by mmoumni ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
void print_error(int error)
{
if (error == 1)
write(2, "FILE ERROR.\n", 12);
else if (error == 2)
write(2, "Invalid Parameters.\n", 21);
else if (error == 3)
write(2, "Allocation Error.\n", 18);
else if (error == 4)
write(2, "Found wrong line length Exiting.\n", 33);
exit(1);
}
int check_filename(char *filename)
{
int i;
i = 0;
while (filename[i])
i++;
if (filename[i - 1] != 'f')
{
print_error(1);
exit(1);
}
return (0);
}