00001
00002 #ifndef _UTILS_H_
00003 #define _UTILS_H_
00004
00005 #ifndef NULL
00006 #define NULL (void *)0
00007 #endif
00008
00009 extern int config_switch(const char *str);
00010 extern int e_mail_check(const char *email);
00011 extern int remove_control_chars(char *str);
00012 extern inline int int2string(char *buffer, int val);
00013 extern inline int lint2string(char *buffer, long int val);
00014 #ifndef USE_MYSQL
00015 unsigned long mysql_escape_string(char * to, const char * from, unsigned long length);
00016 #endif
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifdef _WIN32
00028 #define CL_RESET ""
00029 #define CL_CLS ""
00030 #define CL_CLL ""
00031
00032 #define CL_BOLD ""
00033
00034 #define CL_BLACK ""
00035 #define CL_DARK_RED ""
00036 #define CL_DARK_GREEN ""
00037 #define CL_DARK_YELLOW ""
00038 #define CL_DARK_BLUE ""
00039 #define CL_DARK_MAGENTA ""
00040 #define CL_DARK_CYAN ""
00041 #define CL_DARK_WHITE ""
00042
00043 #define CL_GRAY ""
00044 #define CL_RED ""
00045 #define CL_GREEN ""
00046 #define CL_YELLOW ""
00047 #define CL_BLUE ""
00048 #define CL_MAGENTA ""
00049 #define CL_CYAN ""
00050 #define CL_WHITE ""
00051
00052 #define CL_BG_GRAY ""
00053 #define CL_BG_RED ""
00054 #define CL_BG_GREEN ""
00055 #define CL_BG_YELLOW ""
00056 #define CL_BG_BLUE ""
00057 #define CL_BG_MAGENTA ""
00058 #define CL_BG_CYAN ""
00059 #define CL_BG_WHITE ""
00060 #else
00061 #define CL_RESET "\033[0;0m"
00062 #define CL_CLS "\033[2J"
00063 #define CL_CLL "\033[K"
00064
00065
00066 #define CL_BOLD "\033[1m"
00067
00068 #define CL_BLACK "\033[0;30m" // 0 will reset all value, so re-add background if necessary
00069 #define CL_DARK_RED "\033[0;31m" // 0 will reset all value, so re-add background if necessary
00070 #define CL_DARK_GREEN "\033[0;32m" // 0 will reset all value, so re-add background if necessary
00071 #define CL_DARK_YELLOW "\033[0;33m" // 0 will reset all value, so re-add background if necessary
00072 #define CL_DARK_BLUE "\033[0;34m" // 0 will reset all value, so re-add background if necessary
00073 #define CL_DARK_MAGENTA "\033[0;35m" // 0 will reset all value, so re-add background if necessary
00074 #define CL_DARK_CYAN "\033[0;36m" // 0 will reset all value, so re-add background if necessary
00075 #define CL_DARK_WHITE "\033[0;37m" // 0 will reset all value, so re-add background if necessary
00076
00077 #define CL_GRAY "\033[1;30m"
00078 #define CL_RED "\033[1;31m"
00079 #define CL_GREEN "\033[1;32m"
00080 #define CL_YELLOW "\033[1;33m"
00081 #define CL_BLUE "\033[1;34m"
00082 #define CL_MAGENTA "\033[1;35m"
00083 #define CL_CYAN "\033[1;36m"
00084 #define CL_WHITE "\033[1;37m"
00085
00086 #define CL_BG_GRAY "\033[40m"
00087 #define CL_BG_RED "\033[41m"
00088 #define CL_BG_GREEN "\033[42m"
00089 #define CL_BG_YELLOW "\033[43m"
00090 #define CL_BG_BLUE "\033[44m"
00091 #define CL_BG_MAGENTA "\033[45m"
00092 #define CL_BG_CYAN "\033[46m"
00093 #define CL_BG_WHITE "\033[47m"
00094 #endif
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 #define strcasecmp stringcasecmp
00149 #define strncasecmp stringncasecmp
00150 extern int stringcasecmp(const char *s1, const char *s2);
00151 extern int stringncasecmp(const char *s1, const char *s2, size_t n);
00152
00153 #endif // _UTILS_H_