summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbpc2003 <wpesfriendnva@gmail.com>2025-03-10 11:15:04 -0400
committerbpc2003 <wpesfriendnva@gmail.com>2025-03-10 11:15:04 -0400
commit7c8e83f655e41b11e970fd0abad5a96a3fb73e47 (patch)
tree057e9c4dd571a4f6f4738b51d53641fcb20ea4dc /src
parent9b568eba7d0652e9f9457958f16dc35702c4a950 (diff)
Consolidated each header into single header
Diffstat (limited to 'src')
-rw-r--r--src/file.c (renamed from src/fileops.c)3
-rw-r--r--src/include/fileops.h9
-rw-r--r--src/include/mdb.h (renamed from src/include/keytab.h)25
-rw-r--r--src/include/parser.h20
-rw-r--r--src/keytab.c2
-rw-r--r--src/main.c4
-rw-r--r--src/parser.c2
7 files changed, 27 insertions, 38 deletions
diff --git a/src/fileops.c b/src/file.c
index e43a455..ba24ed3 100644
--- a/src/fileops.c
+++ b/src/file.c
@@ -3,8 +3,7 @@
#include <stdint.h>
#include <string.h>
-#include "include/fileops.h"
-#include "include/keytab.h"
+#include "include/mdb.h"
uint8_t *readdb(char *filename)
{
diff --git a/src/include/fileops.h b/src/include/fileops.h
deleted file mode 100644
index 371f6e8..0000000
--- a/src/include/fileops.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef FILEOPS_H
-#define FILEOPS_H
-
-#include "keytab.h"
-
-unsigned char *readdb(char *filename);
-void writedb(char *filename, struct keytablist *list, int len);
-
-#endif
diff --git a/src/include/keytab.h b/src/include/mdb.h
index 7e15643..6e6fca9 100644
--- a/src/include/keytab.h
+++ b/src/include/mdb.h
@@ -1,8 +1,24 @@
-#ifndef KEYTAB_H
-#define KEYTAB_H
+#ifndef FILEOPS_H
+#define FILEOPS_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;
@@ -24,4 +40,9 @@ struct keytab getkey(struct keytablist *list, int id, char *key);
void 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);
+
#endif
diff --git a/src/include/parser.h b/src/include/parser.h
deleted file mode 100644
index 25045ae..0000000
--- a/src/include/parser.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef PARSER_H
-#define PARSER_H
-
-extern int blen;
-
-enum btype {
- BEGIN = 1,
- END, PAIR,
-
- ERROR
-};
-
-struct byte {
- enum btype type;
- char *value;
-};
-
-struct byte *parse(unsigned char *buf);
-
-#endif
diff --git a/src/keytab.c b/src/keytab.c
index 6fcf303..b1b12d7 100644
--- a/src/keytab.c
+++ b/src/keytab.c
@@ -3,7 +3,7 @@
#include <string.h>
#include <ctype.h>
-#include "include/keytab.h"
+#include "include/mdb.h"
static int hash(char *key);
diff --git a/src/main.c b/src/main.c
index 8bf5319..ac8f102 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,9 +2,7 @@
#include <stdlib.h>
#include <stdint.h>
-#include "include/fileops.h"
-#include "include/parser.h"
-#include "include/keytab.h"
+#include "include/mdb.h"
int main(int argc, char **argv)
{
diff --git a/src/parser.c b/src/parser.c
index 54e7ecc..a45c945 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -2,7 +2,7 @@
#include <stdint.h>
#include <string.h>
-#include "include/parser.h"
+#include "include/mdb.h"
int blen;