From: nishi Date: Sat, 20 Apr 2024 00:23:14 +0000 (+0000) Subject: database X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=b958c17fe2bf62070b4b98fda4d59dac9ed5ef08;p=mandshurica.git database git-svn-id: file:///raid/svn-main/nishi-mandshurica/trunk@44 f982e544-4a7d-3444-ad1a-fde59a2a69f1 --- diff --git a/Mandshurica/db.c b/Mandshurica/db.c index 20ecbc6..2ec742c 100644 --- a/Mandshurica/db.c +++ b/Mandshurica/db.c @@ -29,3 +29,23 @@ /* --- END LICENSE --- */ #include "ms_db.h" + +#include +#include + +struct ms_db* mandshurica_db_open(const char* path) { + FILE* fp = fopen(path, "rb"); + if(fp != NULL) { + struct ms_db* db = malloc(sizeof(*db)); + db->fp = fp; + return db; + } + return NULL; +} + +void mandshurica_db_close(struct ms_db* db) { + fclose(db->fp); + free(db); +} + +char* mandshurica_db_get(struct ms_db* db, const char* key) {} diff --git a/Mandshurica/ms_db.h b/Mandshurica/ms_db.h index f462176..1327d1f 100644 --- a/Mandshurica/ms_db.h +++ b/Mandshurica/ms_db.h @@ -39,5 +39,6 @@ struct ms_db { struct ms_db* mandshurica_db_open(const char* path); void mandshurica_db_close(struct ms_db* db); +char* mandshurica_db_get(struct ms_db* db, const char* key); #endif