aboutsummaryrefslogtreecommitdiff
path: root/src/msg.h
blob: e872578dde0a5d65f946b7d55ff9fe9941b52415 (plain)
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
#ifndef __MSG_H__
#define __MSG_H__

#include <stdio.h>
#include "prefs.h"

/*
 * You can disable any MSG* macro by adding the '_' prefix.
 */
#define _MSG(...)
#define _MSG_WARN(...)
#define _MSG_HTML(...)
#define _MSG_HTTP(...)


#define MSG(...)                                   \
   D_STMT_START {                                  \
      if (prefs.show_msg){                         \
         printf(__VA_ARGS__);                      \
         fflush (stdout);                          \
      }                                            \
   } D_STMT_END

#define MSG_WARN(...)                              \
   D_STMT_START {                                  \
      if (prefs.show_msg)                          \
         printf("** WARNING **: " __VA_ARGS__);    \
   } D_STMT_END

#define MSG_ERR(...)                               \
   D_STMT_START {                                  \
      if (prefs.show_msg)                          \
         printf("** ERROR **: " __VA_ARGS__);      \
   } D_STMT_END

#define MSG_HTML(...)                              \
   D_STMT_START {                                  \
         Html_msg(html, __VA_ARGS__);              \
   } D_STMT_END

#define MSG_HTTP(...)                              \
   printf("HTTP warning: " __VA_ARGS__)

#endif /* __MSG_H__ */