-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandle_Error.c
More file actions
64 lines (58 loc) · 1.23 KB
/
Handle_Error.c
File metadata and controls
64 lines (58 loc) · 1.23 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
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "shell.h"
/**
* Error_display - print error message
* @user_INPUT: user input received
* @timer: loop counter
* @argv: Arguments before program starts
*
*/
void Error_display(char *user_INPUT, int timer, char **argv)
{
char *error;
/******print ******/
Shell_PRINT(argv[0]);
Shell_PRINT(": ");
error = F_itoa(timer);
Shell_PRINT(error);
free(error);
Shell_PRINT(": ");
Shell_PRINT(user_INPUT);
Shell_PRINT(": not found\n");
}
/**
* Error_print_custom - output custom Error
* @argv: Arguments before program starts
* @b: Error timer
* @cmd: Array of parsed command strings
*/
void Error_print_custom(char **argv, int b, char **cmd)
{
char *error = F_itoa(b);
/****shell print********/
Shell_PRINT(argv[0]);
Shell_PRINT(": ");
Shell_PRINT(error);
Shell_PRINT(": ");
Shell_PRINT(cmd[0]);
Shell_PRINT(": number illegal: ");
Shell_PRINT(cmd[1]);
Shell_PRINT("\n");
free(error);
}
/**
* Error_print_file - output custom Error
* @argv: Arguments before program starts
* @b: Error timer
*/
void Error_print_file(char **argv, int b)
{
char *error = F_itoa(b);
/*******shell print*****/
Shell_PRINT(argv[0]);
Shell_PRINT(": ");
Shell_PRINT(error);
Shell_PRINT(": Can't open ");
Shell_PRINT(argv[1]);
Shell_PRINT("\n");
free(error);
}