summaryrefslogtreecommitdiff
path: root/C/final-project-z2h/include/parse.h
diff options
context:
space:
mode:
Diffstat (limited to 'C/final-project-z2h/include/parse.h')
-rw-r--r--C/final-project-z2h/include/parse.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/C/final-project-z2h/include/parse.h b/C/final-project-z2h/include/parse.h
new file mode 100644
index 0000000..edcda9b
--- /dev/null
+++ b/C/final-project-z2h/include/parse.h
@@ -0,0 +1,26 @@
+#ifndef PARSE_H
+#define PARSE_H
+
+#define HEADER_MAGIC 0x4c4c4144
+
+struct dbheader_t {
+ unsigned int magic;
+ unsigned short version;
+ unsigned short count;
+ unsigned int filesize;
+};
+
+struct employee_t {
+ char name[256];
+ char address[256];
+ unsigned int hours;
+};
+
+int create_db_header(int fd, struct dbheader_t **headerOut);
+int validate_db_header(int fd, struct dbheader_t **headerOut);
+int read_employees(int fd, struct dbheader_t *, struct employee_t **employeesOut);
+int output_file(int fd, struct dbheader_t *, struct employee_t *employees);
+void list_employees(struct dbheader_t *dbhdr, struct employee_t *employees);
+int add_employee(struct dbheader_t *dbhdr, struct employee_t *employees, char *addstring);
+
+#endif