-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.c
More file actions
executable file
·51 lines (46 loc) · 1.72 KB
/
error.c
File metadata and controls
executable file
·51 lines (46 loc) · 1.72 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
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hyeyeom <hyeyeom@42student.gyeongsan.kr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/26 13:56:54 by yuhyoon #+# #+# */
/* Updated: 2025/04/14 00:38:35 by hyeyeom ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void err_such(int exit, char *obj)
{
*f_exitcode() = exit;
write(2, "minish: ", 8);
write(2, obj, ft_strlen(obj));
write(2, ": ", 2);
write(2, "No such file or directory\n", 26);
}
void err_permission(int exit, char *obj)
{
*f_exitcode() = exit;
write(2, "minish: ", 8);
write(2, obj, ft_strlen(obj));
write(2, ": ", 2);
write(2, "Permission denied\n", 18);
}
void err_exec(int exit, char *cmd_name)
{
*f_exitcode() = exit;
write(2, "minish: ", 8);
write(2, cmd_name, (unsigned int)ft_strlen(cmd_name));
write(2, " command not found\n", 19);
}
void err_syntax(int syntax_result)
{
if (syntax_result == 0)
return ;
*f_exitcode() = syntax_result;
write(2, "minish: ", 8);
if (syntax_result == 1)
write(2, "syntax error!\n", 14);
else if (syntax_result == 2)
write(2, "syntax error! minishell don't support.\n", 39);
}