view lout/msg.h @ 2018:e24250227e83

rm --enable-ansi config option I'd brought this up a couple of times on the list, and we never came to a definite "Yes, let's rm it!", but it isn't close to working, and we're never going to take out various C99 things that it disallows, so...
author corvid <corvid@lavabit.com>
date Sun, 15 May 2011 21:46:53 +0000
parents 539fb21aea7d
children
line wrap: on
line source
#ifndef __MSG_H__
#define __MSG_H__

#include <stdio.h>

#define prefs_show_msg    1

#define D_STMT_START      do
#define D_STMT_END        while (0)

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


#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

#endif /* __MSG_H__ */