13 LOG_WARNF(
"^1Can't write DB to %s", filename);
17 for (
int i = 0, n = buf_getsize(db); i < n; ++i)
29 #define HM_NEW(this) (this = db_create()) 32 void db_put(
int db,
string key,
string value);
38 if (db < 0)
return -1;
40 if (fh < 0)
return db;
44 for (
int i = 0; (l =
fgets(fh)); ++i)
46 if (l !=
"") bufstr_set(db, i, l);
59 for (
int j = 2; j < n; j += 2)
62 while ((l =
fgets(fh)));
72 if (fh < 0)
LOG_FATALF(
"Can't dump DB to %s", filename);
74 for (
int i = 0, n = buf_getsize(db); i < n; ++i)
77 for (
int j = 2; j < m; j += 2)
88 #define HM_DELETE(this) db_close(this) 94 return uri_unescape(infoget(bufstr_get(db, h), key));
96 #define HM_gets(this, k) db_get(this, k) 98 #define db_remove(db, key) db_put(db, key, "") 101 void db_put(
int db,
string key,
string value)
104 bufstr_set(db, h, infoadd(bufstr_get(db, h), key, uri_escape(value)));
106 #define HM_sets(this, key, val) db_put(this, key, val) ERASEABLE int db_create()
ERASEABLE void db_put(int db, string key, string value)
ERASEABLE int db_load(string filename)
ERASEABLE void db_close(int db)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
ERASEABLE void db_save(int db, string filename)
ERASEABLE void db_dump(int db, string filename)
ERASEABLE string db_get(int db, string key)
#define tokenizebyseparator