#ifndef DBG_H
#define DBG_H

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define dbg(...) fprintf (stderr, __VA_ARGS__)

#define fatal(x)                                                              \
  do                                                                          \
    {                                                                         \
      fprintf (stderr, "(%s:%d) %s () failed: %s errno: %s\n", __FILE__,      \
               __LINE__, __extension__ __func__, x, strerror (errno));        \
      exit (EXIT_FAILURE);                                                    \
    }                                                                         \
  while (0)

#endif /* DBG_H  */
