-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patherror.c
More file actions
executable file
·50 lines (42 loc) · 757 Bytes
/
error.c
File metadata and controls
executable file
·50 lines (42 loc) · 757 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
39
40
41
42
43
44
45
46
47
48
49
50
#include <string.h>
#include <errno.h>
#include "job.h"
/* ´íÎó´¦Àí */
void error_doit(int errnoflag,const char *fmt,va_list ap)
{
int errno_save;
char buf[BUFLEN];
errno_save=errno;
vsprintf(buf,fmt,ap);
if (errnoflag)
sprintf(buf+strlen(buf),":%s",strerror(errno_save));
strcat(buf,"\n");
fflush(stdout);
fputs(buf,stderr);
fflush(NULL);
return;
}
void error_sys(const char *fmt,...)
{
va_list ap;
va_start(ap,fmt);
error_doit(1,fmt,ap);
va_end(ap);
exit(1);
}
void error_quit(const char *fmt,...)
{
va_list ap;
va_start(ap,fmt);
error_doit(0,fmt,ap);
va_end(ap);
exit(1);
}
void error_msg(const char *fmt,...)
{
va_list ap;
va_start(ap,fmt);
error_doit(0,fmt,ap);
va_end(ap);
return;
}