diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/mdb.h | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/src/include/mdb.h b/src/include/mdb.h index 6e6fca9..49f5903 100644 --- a/src/include/mdb.h +++ b/src/include/mdb.h @@ -1,24 +1,8 @@ -#ifndef FILEOPS_H -#define FILEOPS_H +#ifndef MDB_H +#define MDB_H #define TABLEN 1024 -extern int blen; - -enum btype { - BEGIN = 1, - END, PAIR, - - ERROR -}; - -struct byte { - enum btype type; - char *value; -}; - -struct byte *parse(unsigned char *buf); - union value { char *str; double num; @@ -32,17 +16,16 @@ struct keytab { }; struct keytablist { + int len; struct keytab tab[TABLEN]; }; int *getkeys(struct keytablist *list, int id); struct keytab getkey(struct keytablist *list, int id, char *key); -void setkey(struct keytablist **list, int *len, int id, char *pair); +int setkey(struct keytablist **list, int *len, int id, char *pair); void delkey(struct keytablist *list, int id, char *key); -// TODO: integrate every header into single file -// TODO: make readdb return struct keytab list* -unsigned char *readdb(char *filename); -void writedb(char *filename, struct keytablist *list, int len); +struct keytablist *readdb(char *filename); +void writedb(char *filename, struct keytablist *list); #endif |