return NULL;
}
+#ifdef WIN32\r
+#ifndef vsnprintf\r
+#define vsnprintf _vsnprintf\r
+#endif\r
+#endif\r
+\r
+int esl_snprintf(char *buffer, size_t count, const char *fmt, ...)\r
+{\r
+ va_list ap;\r
+ int ret;\r
+\r
+ va_start(ap, fmt);\r
+ ret = vsnprintf(buffer, count-1, fmt, ap);\r
+ if (ret < 0)\r
+ buffer[count-1] = '\0';\r
+ va_end(ap);\r
+ return ret;\r
+}
static void null_logger(const char *file, const char *func, int line, int level, const char *fmt, ...)
{
if (file_path[0] == '/') {
path = file_path;
} else {
- snprintf(path_buf, sizeof(path_buf), "%s%s%s", ESL_CONFIG_DIR, ESL_PATH_SEPARATOR, file_path);
+ esl_snprintf(path_buf, sizeof(path_buf), "%s%s%s", ESL_CONFIG_DIR, ESL_PATH_SEPARATOR, file_path);
path = path_buf;
}
int last = -1;
char *var, *val;
- snprintf(path_buf, sizeof(path_buf), "%s%sopenesl.conf", ESL_CONFIG_DIR, ESL_PATH_SEPARATOR);
+ esl_snprintf(path_buf, sizeof(path_buf), "%s%sopenesl.conf", ESL_CONFIG_DIR, ESL_PATH_SEPARATOR);
path = path_buf;
if ((f = fopen(path, "r")) == 0) {
if (encode) {
esl_url_encode(hp->value, encode_buf, encode_len);
} else {
- snprintf(encode_buf, encode_len, "[%s]", hp->value);
+ esl_snprintf(encode_buf, encode_len, "[%s]", hp->value);
}
llen = strlen(hp->name) + strlen(encode_buf) + 8;
const char *esl_stristr(const char *instr, const char *str);
int esl_toupper(int c);
int esl_tolower(int c);
+int esl_snprintf(char *buffer, size_t count, const char *fmt, ...);\r
+
typedef void (*esl_listen_callback_t)(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in addr);