-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.c
61 lines (53 loc) · 1.52 KB
/
error.c
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
51
52
53
54
55
56
57
58
59
60
61
/***********************************************
* IOS Project 2 - 8.4.2014
* File: error.c
* Author: Lukáš Rendvanský, FIT
* E-mail: xrendv00@stud.fit.vutbr.cz
* Compiled with: gcc 4.7.2-1
* Library for printing warning and error messages.
************************************************/
/*
* Including used libraries and files.
*/
#include <stdlib.h> // library for standard functions
#include <stdio.h> // library for input and output
#include <stdarg.h> // library for indefinite number of arguments
// headers with functions description
#include "error.h"
void Warning(FILE *stream, const char *fmt, ...){
va_list arguments;
va_start(arguments, fmt);
fprintf(stream, "Warning: ");
vfprintf(stream, fmt, arguments);
fputc('\n',stream);
va_end(arguments);
return;
}
void ExitMessage(FILE *stream, const char *fmt, ...){
va_list arguments;
va_start(arguments, fmt);
fprintf(stream,"Closing: ");
vfprintf(stream, fmt, arguments);
fputc('\n',stream);
va_end(arguments);
exit(0);
}
void InputError(FILE *stream, const char *fmt, ...){
va_list arguments;
va_start(arguments, fmt);
fprintf(stream, "Error: ");
vfprintf(stream, fmt, arguments);
fputc('\n',stream);
va_end(arguments);
exit(1);
}
void SyscallError(FILE *stream, const char *fmt, ...){
va_list arguments;
va_start(arguments, fmt);
fprintf(stream, "Error: ");
vfprintf(stream, fmt, arguments);
fputc('\n',stream);
va_end(arguments);
exit(2);
}
/* End of file error.c */