-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathError.cpp
More file actions
43 lines (36 loc) · 1.22 KB
/
Error.cpp
File metadata and controls
43 lines (36 loc) · 1.22 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
/*
8888ba.88ba 888888ba a88888b. dP
88 `8b `8b 88 `8b d8' `88 88
88 88 88 a88aaaa8P' 88 .d8888b. dP dP 88d888b. d8888P
88 88 88 88 88 88' `88 88 88 88' `88 88
88 88 88 88 Y8. .88 88. .88 88. .88 88 88 88
dP dP dP dP Y88888P' `88888P' `88888P' dP dP dP
MPCount
Pedro M P Ribeiro - pribeiro@fc.up.pt
Andre Couto Meira - andre.meira@fc.up.pt
*/
/*
* Error utilities.
*
* Last Update: 02/2026
*
*/
#include "Error.h"
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void Error::msg(const char *format, ...) {
va_list p;
if (format == NULL)
msg("%s", (char *)strerror(errno));
else {
fprintf(stderr, ERROR_HEADER);
va_start(p, format);
vfprintf(stderr, format, p);
va_end(p);
fprintf(stderr, "\n");
}
exit(EXIT_FAILURE);
}