-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherr.cpp
More file actions
32 lines (28 loc) · 699 Bytes
/
Copy patherr.cpp
File metadata and controls
32 lines (28 loc) · 699 Bytes
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
/* Kod pochodzi z labów moodle, nie jestem jego autorem */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "err.h"
void syserr(const char *fmt, ...)
{
va_list fmt_args;
int errno1 = errno;
fprintf(stderr, "ERROR: ");
va_start(fmt_args, fmt);
vfprintf(stderr, fmt, fmt_args);
va_end(fmt_args);
fprintf(stderr, " (%d; %s)\n", errno1, strerror(errno1));
exit(EXIT_FAILURE);
}
void fatal(const char *fmt, ...)
{
va_list fmt_args;
fprintf(stderr, "ERROR: ");
va_start(fmt_args, fmt);
vfprintf(stderr, fmt, fmt_args);
va_end(fmt_args);
fprintf(stderr, "\n");
exit(EXIT_FAILURE);
}