Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "main.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <string.h>
- #include <errno.h>
- #include <sys/socket.h>
- #define F_EXIT_FAILURE 1
- #define F_EXIT_SUCCESS 0
- #define errno_s strerror(errno)
- void
- fatal(const char *fmt, ...)
- {
- va_list vargs;
- va_start(vargs, fmt);
- vfprintf(stderr, fmt, vargs);
- fprintf(stderr, ".\n");
- va_end(vargs);
- exit(EXIT_FAILURE);
- }
- int appcore_debug = 0;
- void
- appcore_debug_internal(char *file, int line, const char *fmt, ...) {
- va_list vargs;
- char buf[2048];
- va_start(vargs, fmt);
- vsnprintf(buf, sizeof(buf), fmt, vargs);
- va_end(vargs);
- printf("%s:%d - %s\n", file, line, buf);
- }
- #define appcore_debug(...) \
- if(appcore_debug) \
- appcore_debug_internal(__FILE__, __LINE__, __VA_ARGS__)
- int
- main(int argc, char** argv)
- {
- appcore_debug("%s : %s", "sf", "sfdsfd");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement