add flexible compilation, allow to select sqlite support or not

This commit is contained in:
lxsang
2016-02-26 14:32:13 +01:00
parent d14351de2c
commit e75303b2e1
14 changed files with 16 additions and 10 deletions

Binary file not shown.

View File

@ -11,6 +11,7 @@ void __init_plugin__(const char* pl,const char*ph,const char* htdocs, const char
__plugin__.pdir = strdup(pdir);
if(__init__ != NULL) __init__();
};
#ifdef USE_DB
sqldb getdb()
{
int plen = strlen(__plugin__.name)+strlen(__plugin__.dbpath)+4;
@ -22,6 +23,7 @@ sqldb getdb()
free(path);
return ret;
}
#endif
void header_base(int client)
{

View File

@ -1,7 +1,9 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#ifdef USE_DB
#include "dbhelper.h"
#endif
#include "dictionary.h"
#include "list.h"
@ -24,9 +26,9 @@ typedef struct {
typedef void(*call)();
#ifdef USE_DB
typedef sqlite3* sqldb;
#endif
extern plugin_header __plugin__;
extern call __init__;
@ -48,8 +50,9 @@ int __fb(int, const char*);
int upload(const char*, const char*);
char* route(const char*);
char* htdocs(const char*);
#ifdef USE_DB
sqldb getdb();
void dbclose(sqldb);
#endif
void set_cookie(int,dictionary);
/*Default function for plugin*/

Binary file not shown.

View File

@ -325,4 +325,4 @@ unsigned hash(const char* key, int hash_size)
for (hashval = 0; *key != '\0'; key++)
hashval = *key + 31 * hashval;
return hashval % hash_size;
}
}

View File

@ -40,6 +40,7 @@ THE SOFTWARE.
#define IEQU(a,b) (strcasecmp(a,b) == 0)
#define IS_INT(a) (match_int(a))
#define IS_FLOAT(a) (match_float(a))
#define FILE_OK(f) ( access( f, F_OK ) != -1 )
#define DIR_SEP "/"
#define true 1
#define false 0