Added log utility and improved server
This commit is contained in:
@ -13,9 +13,6 @@
|
||||
#if !defined(BUFSIZE)
|
||||
#define BUFSIZE 256
|
||||
#endif
|
||||
#if !defined(SOCKNAME)
|
||||
#define SOCKNAME "./cs_sock"
|
||||
#endif
|
||||
#if !defined(MAXBACKLOG)
|
||||
#define MAXBACKLOG 32
|
||||
#endif
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include <ini.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define CONFGETINT(var, config, t, q, p, base) \
|
||||
@ -14,5 +15,16 @@
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define CONFGETSTR(var, config, t, q, buff) \
|
||||
var = ini_get(config, t, q); \
|
||||
if(var==NULL) { \
|
||||
fprintf(stderr, "ERROR reading config for variable %c\n", t); \
|
||||
ini_free(config); \
|
||||
return 1; \
|
||||
} \
|
||||
buff = calloc(strlen(var)+1, sizeof(char)); \
|
||||
strncpy(buff, var, strlen(var)+1); \
|
||||
var = buff;
|
||||
|
||||
|
||||
#endif /* _SERVER_STATUS */
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#ifndef _UTIL_H
|
||||
#define _UTIL_H
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
Reference in New Issue
Block a user