GCC Code Coverage Report


Directory: ./
File: lib/my/my_strerror.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 4 4 100.0%
Functions: 1 1 100.0%
Branches: 3 4 75.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2024
3 ** my_strerror
4 ** File description:
5 ** Returns the error message of the error number (error)
6 */
7 /**
8 * @file my_strerror.c
9 * @brief The file containing the my_strerror function
10 * @author Nicolas TORO
11 */
12
13 #include "my.h"
14
15 const char *error_list[] = {
16 "Success",
17 "Operation not permitted",
18 "No such file or directory",
19 "No such process",
20 "Interrupted system call",
21 "I/O error",
22 "No such device or address",
23 "Argument list too long",
24 "Exec format error",
25 "Bad file number",
26 "No child processes",
27 "Try again",
28 "Out of memory",
29 "Permission denied",
30 "Bad address",
31 "Block device required",
32 "Device or resource busy",
33 "File exists",
34 "Cross-device link",
35 "No such device",
36 "Not a directory",
37 "Is a directory",
38 "Invalid argument",
39 "File table overflow",
40 "Too many open files",
41 "Not a typewriter",
42 "Text file busy",
43 "File too large",
44 "No space left on device",
45 "Illegal seek",
46 "Read-only file system",
47 "Too many links",
48 "Broken pipe",
49 "Math argument out of domain of func",
50 "Math result not representable",
51 "Resource deadlock would occur",
52 "File name too long",
53 "No record locks available",
54 "Function not implemented",
55 "Directory not empty",
56 "Too many symbolic links encountered",
57 "Operation would block",
58 "No message of desired type",
59 "Identifier removed",
60 "Channel number out of range",
61 "Level 2 not synchronized",
62 "Level 3 halted",
63 "Level 3 reset",
64 "Link number out of range",
65 "Protocol driver not attached",
66 "No CSI structure available",
67 "Level 2 halted",
68 "Invalid exchange",
69 "Invalid request descriptor",
70 "Exchange full",
71 "No anode",
72 "Invalid request code",
73 "Invalid slot",
74 "Bad font file format",
75 "Device not a stream",
76 "No data available",
77 "Timer expired",
78 "Out of streams resources",
79 "Machine is not on the network",
80 "Package not installed",
81 "Object is remote",
82 "Link has been severed",
83 "Advertise error",
84 "Srmount error",
85 "Communication error on send",
86 "Protocol error",
87 "Multihop attempted",
88 "RFS specific error",
89 "Not a data message",
90 "Value too large for defined data type",
91 "Name not unique on network",
92 "File descriptor in bad state",
93 "Remote address changed",
94 "Can not access a needed shared library",
95 "Accessing a corrupted shared library",
96 ".lib section in a.out corrupted",
97 "Attempting to link in too many shared libraries",
98 "Cannot exec a shared library directly",
99 "Illegal byte sequence",
100 "Interrupted system call should be restarted",
101 "Streams pipe error",
102 "Too many users",
103 "Socket operation on non-socket",
104 "Destination address required",
105 "Message too long",
106 "Protocol wrong type for socket",
107 "Protocol not available",
108 "Protocol not supported",
109 "Socket type not supported",
110 "Operation not supported on transport endpoint",
111 "Protocol family not supported",
112 "Address family not supported by protocol",
113 "Address already in use",
114 "Cannot assign requested address",
115 "Network is down",
116 "Network is unreachable",
117 "Network dropped connection because of reset",
118 "Software caused connection abort",
119 "Connection reset by peer",
120 "No buffer space available",
121 "Transport endpoint is already connected",
122 "Transport endpoint is not connected",
123 "Cannot send after transport endpoint shutdown",
124 "Too many references: cannot splice",
125 "Connection timed out",
126 "Connection refused",
127 "Operation already in progress",
128 "Operation now in progress",
129 "Stale file handle",
130 "Structure needs cleaning",
131 "Not a XENIX named type file",
132 "No XENIX semaphores available",
133 "Is a named type file",
134 "Remote I/O error",
135 "Quota exceeded",
136 "No medium found",
137 "Wrong medium type",
138 "Operation Canceled",
139 "Required key not available",
140 "Key has expired",
141 "Key has been revoked",
142 "Key was rejected by service",
143 "Owner died",
144 "State not recoverable",
145 "Operation not possible due to RF-kill",
146 "Memory page has hardware error",
147 };
148
149 4 const char *my_strerror(int error)
150 {
151
3/4
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
4 if (error < 0 || error > 133)
152 1 return NULL;
153 3 return error_list[error];
154 }
155