/*----------------------------------------------------------------------*/
/* Debug for embeded board, 2008-2-26, Rain. */
/*----------------------------------------------------------------------*/
#define PRINT_DEBUG 1
#define UNDERLINE "\033[4m"
#define BLACK "\033[30m"
#define RED "\033[31m"
#define GREEN "\033[32m"
#define YELLOW "\033[33m"
#define BLUE "\033[34m"
#define PURPLE "\033[35m"
#define DARKGREEN "\033[36m"
#define WHITE "\033[37m"
#define BG_BLACK "\033[40m"
#define BG_RED "\033[41m"
#define BG_GREEN "\033[42m"
#define BG_YELLOW "\033[43m"
#define BG_BLUE "\033[44m"
#define BG_PURPLE "\033[45m"
#define BG_DARKGREEN "\033[46m"
#define BG_WHITE "\033[47m"
#define CLOSE "\033[0m"
#define cprintf(fmt, args...) do \
{ \
FILE *fp1 = fopen("/dev/tty", "a"); \
FILE *fp2 = fopen("/tmp/dbg.txt", "a"); \
int flag = 0; \
if (fp1 && (flag == 0 || flag == 2)) { \
fprintf(fp1, fmt, ## args); \
fclose(fp1); \
} \
if (fp2 && (flag == 1 || flag == 2)) { \
fprintf(fp2, fmt, ## args); \
fclose(fp2); \
} \
} while (0)
#ifdef PRINT_DEBUG
#define dbg(fmt, args...) \
cprintf("==> CGI_DEBUG %s | %s %d | " fmt CLOSE, __FILE__, __FUNCTION__, __LINE__, ##args)
#else
#define dbg(fmt, args...)
#endif
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* Debug for SSH terminal, 2008-2-26, Rain. */
/*----------------------------------------------------------------------*/
#define PRINT_DEBUG 1
#define UNDERLINE "\033[4m"
#define BLACK "\033[30m"
#define RED "\033[31m"
#define GREEN "\033[32m"
#define YELLOW "\033[33m"
#define BLUE "\033[34m"
#define PURPLE "\033[35m"
#define DARKGREEN "\033[36m"
#define WHITE "\033[37m"
#define BG_BLACK "\033[40m"
#define BG_RED "\033[41m"
#define BG_GREEN "\033[42m"
#define BG_YELLOW "\033[43m"
#define BG_BLUE "\033[44m"
#define BG_PURPLE "\033[45m"
#define BG_DARKGREEN "\033[46m"
#define BG_WHITE "\033[47m"
#define CLOSE "\033[0m"
#define cprintf(fmt, args...) do \
{ \
char *dev = getenv("SSH_TTY"); \
FILE *fp1 = fopen(dev, "a"); \
FILE *fp2 = fopen("/tmp/dbg.txt", "a"); \
int flag = 0; \
if (fp1 && (flag == 0 || flag == 2)) { \
fprintf(fp1, fmt, ## args); \
fclose(fp1); \
} \
if (fp2 && (flag == 1 || flag == 2)) { \
fprintf(fp2, fmt, ## args); \
fclose(fp2); \
} \
} while (0)
#ifdef PRINT_DEBUG
#define dbg(fmt, args...) \
cprintf("==> CGI_DEBUG %s | %s %d | " fmt CLOSE, __FILE__, __FUNCTION__, __LINE__, ##args)
#else
#define dbg(fmt, args...)
#endif
/*----------------------------------------------------------------------*/
/* Debug for embeded board, 2008-2-26, Rain. */
/*----------------------------------------------------------------------*/
#define PRINT_DEBUG 1
#define UNDERLINE "\033[4m"
#define BLACK "\033[30m"
#define RED "\033[31m"
#define GREEN "\033[32m"
#define YELLOW "\033[33m"
#define BLUE "\033[34m"
#define PURPLE "\033[35m"
#define DARKGREEN "\033[36m"
#define WHITE "\033[37m"
#define BG_BLACK "\033[40m"
#define BG_RED "\033[41m"
#define BG_GREEN "\033[42m"
#define BG_YELLOW "\033[43m"
#define BG_BLUE "\033[44m"
#define BG_PURPLE "\033[45m"
#define BG_DARKGREEN "\033[46m"
#define BG_WHITE "\033[47m"
#define CLOSE "\033[0m"
#define cprintf(fmt, args...) do \
{ \
FILE *fp1 = fopen("/dev/tty", "a"); \
FILE *fp2 = fopen("/tmp/dbg.txt", "a"); \
int flag = 0; \
if (fp1 && (flag == 0 || flag == 2)) { \
fprintf(fp1, fmt, ## args); \
fclose(fp1); \
} \
if (fp2 && (flag == 1 || flag == 2)) { \
fprintf(fp2, fmt, ## args); \
fclose(fp2); \
} \
} while (0)
#ifdef PRINT_DEBUG
#define dbg(fmt, args...) \
cprintf("==> CGI_DEBUG %s | %s %d | " fmt CLOSE, __FILE__, __FUNCTION__, __LINE__, ##args)
#else
#define dbg(fmt, args...)
#endif
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* Debug for SSH terminal, 2008-2-26, Rain. */
/*----------------------------------------------------------------------*/
#define PRINT_DEBUG 1
#define UNDERLINE "\033[4m"
#define BLACK "\033[30m"
#define RED "\033[31m"
#define GREEN "\033[32m"
#define YELLOW "\033[33m"
#define BLUE "\033[34m"
#define PURPLE "\033[35m"
#define DARKGREEN "\033[36m"
#define WHITE "\033[37m"
#define BG_BLACK "\033[40m"
#define BG_RED "\033[41m"
#define BG_GREEN "\033[42m"
#define BG_YELLOW "\033[43m"
#define BG_BLUE "\033[44m"
#define BG_PURPLE "\033[45m"
#define BG_DARKGREEN "\033[46m"
#define BG_WHITE "\033[47m"
#define CLOSE "\033[0m"
#define cprintf(fmt, args...) do \
{ \
char *dev = getenv("SSH_TTY"); \
FILE *fp1 = fopen(dev, "a"); \
FILE *fp2 = fopen("/tmp/dbg.txt", "a"); \
int flag = 0; \
if (fp1 && (flag == 0 || flag == 2)) { \
fprintf(fp1, fmt, ## args); \
fclose(fp1); \
} \
if (fp2 && (flag == 1 || flag == 2)) { \
fprintf(fp2, fmt, ## args); \
fclose(fp2); \
} \
} while (0)
#ifdef PRINT_DEBUG
#define dbg(fmt, args...) \
cprintf("==> CGI_DEBUG %s | %s %d | " fmt CLOSE, __FILE__, __FUNCTION__, __LINE__, ##args)
#else
#define dbg(fmt, args...)
#endif
/*----------------------------------------------------------------------*/