-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_utils_for_pars.c
40 lines (37 loc) · 1.3 KB
/
error_utils_for_pars.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error_utils_for_pars.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zkarapet <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 21:53:19 by zkarapet #+# #+# */
/* Updated: 2023/03/03 21:21:27 by zkarapet ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int parsing_error_checks(char *s)
{
if (s[0] == '\0')
return (1);
if (!find_unquoted(s))
{
ft_putstr_fd("Missing quote\n", 1, 0);
g_status = 1;
return (1);
}
else if (!last_pipe_check(s))
{
ft_putstr_fd("Parsing error near '|'\n", 1, 0);
g_status = 1;
return (1);
}
g_status = 0;
return (0);
}
void ft_perror_and_exit(char *cmd, int code)
{
perror(cmd);
g_status = code;
exit(code);
}