blob: 4df5d07c5f7b990fe0fe93ea939a88b882c61dbe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#ifndef ERROR_H
#define ERROR_H
#include <stdio.h>
#include <stdlib.h>
enum errcode {
OK = 0,
GENERAL_ERROR = 1,
COMMAND_NOT_FOUND = 2,
UNKNOWN_ID,
SYNTAX_ERROR,
INVALID_ARGUMENTS
};
/* FIXME: double fprintf is ugly */
#define error(v, ...) do { \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
exit(v); \
} while (0)
#endif /* ERROR_H */
|