-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiagnostic.h
56 lines (46 loc) · 1.16 KB
/
diagnostic.h
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
#ifndef DIAGNOSTIC_H
#define DIAGNOSTIC_H
#include <stdarg.h>
#include <stdbool.h>
/**
* info - display msg to user running yak
*/
void info(char* format, ...);
/**
* err - display error msg to user running yak
*/
void err(char* format, ...);
/**
* err - display error msg with errno information to user running yak
*/
void err_errno(char* format, ...);
/**
* safe_shutdown - nicely shut down all running services without exitting
*/
void safe_shutdown();
/**
* safe_shutdown_and_die - nicely shut down all running services, then exit
*/
void safe_shutdown_and_die(int code);
/**
* add_shutdown_fn - have safe_shutdown call a function when it is called
*
* Functions are called in first-in-last-out order.
*/
void add_shutdown_fn(void (*fn)());
/**
* die - print err msg, then exit immediately
*/
void die(char* msg);
/**
* want_quit - request a safe shutdown
*
* When a part of the program wants to quit in a super polite manner, they can
* toggle this flag. It's even more polite than calling safe_shutdown()
* directly.
*
* When the program finishes its current iteration of the main IRC processing
* loop, it will quit.
*/
extern bool want_quit;
#endif