-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherr.c
More file actions
38 lines (30 loc) · 655 Bytes
/
err.c
File metadata and controls
38 lines (30 loc) · 655 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
33
34
35
36
37
38
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#include "err.h"
extern int sys_nerr;
void syserr(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," (%d; %s)\n", errno, strerror(errno));
exit(1);
}
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(1);
}