embedded libev

This commit is contained in:
Max Lv
2013-04-01 17:56:39 +08:00
parent 5e65653d54
commit e2efa22733
65 changed files with 54544 additions and 596 deletions
+29
View File
@@ -0,0 +1,29 @@
#ifndef _UTILS_H
#define _UTILS_H
#define STR(x) #x
#define TOSTR(x) STR(x)
#define TIME_FORMAT "%F %T"
#define LOGD(format, ...) do {\
time_t now = time(NULL);\
char timestr[20];\
strftime(timestr, 20, TIME_FORMAT, localtime(&now));\
fprintf(stderr, "\e[01;32m %s INFO: \e[0m" format "\n", timestr, ##__VA_ARGS__);}\
while(0)
#define LOGE(format, ...) do {\
time_t now = time(NULL);\
char timestr[20];\
strftime(timestr, 20, TIME_FORMAT, localtime(&now));\
fprintf(stderr, "\e[01;35m %s ERROR: \e[0m" format " on File: %s Line: %s\n", timestr, ##__VA_ARGS__, __FILE__, TOSTR(__LINE__));}\
while(0)
#define VERSION "0.9"
void FATAL(const char *msg);
void usage(void);
void demonize(const char* path);
char *itoa(int i);
#endif // _UTILS_H