Updated project structure and makefile. Started creating frontend. Created csv database interphase

This commit is contained in:
2020-06-30 12:39:50 +05:00
parent 457a52a585
commit db9b46f041
28 changed files with 643 additions and 89 deletions

11
include/db_op/blogpost.h Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
#include <unistd.h>
typedef struct
{
char *header;
char *content;
char **tags;
char *author;
unsigned int key;
} blogpost_t;

17
include/db_op/db.h Normal file
View File

@ -0,0 +1,17 @@
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "./blogpost.h"
#define LINE_SIZE 512
int open_db(char *file_name, char *type, FILE **file, char ***head, int *head_length);
int open_table(char *file_name, FILE **file);
int read_head(FILE *file, char ***head);
int get_entry(FILE *file, void **rec, int type, int n, int (*process_line)(char *, void **, int));
int append_table(FILE *file, void *rec, int type, char *(*process_line)(void *, int));
int remove_entry(FILE *file, int n);

View File

@ -1,3 +1,10 @@
#include <string.h>
#include <stdlib.h>
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
struct file_s
{
char *path;

View File

@ -1 +1,3 @@
#include <string.h>
char *get_mime_type(char *file_path);

View File

@ -1,2 +0,0 @@
int get_listener_socket(char *port);
void *get_in_addr(struct sockaddr *sa);

8
include/netw_op/netw.h Normal file
View File

@ -0,0 +1,8 @@
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netdb.h>
int get_listener_socket(char *port);
void *get_in_addr(struct sockaddr *sa);

View File

@ -1,3 +1,13 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
struct header_s {
char * str;
size_t size;

5
include/utils_op/arr.h Normal file
View File

@ -0,0 +1,5 @@
#include <string.h>
#include <stdlib.h>
void insert_to_arr(char ***arr, size_t length, char *value);
void free_arr(char **arr, int length);

0
include/utils_op/llist.h Normal file
View File

View File

@ -1,3 +1,8 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
void err_msg(char *msg);
char *add_to_front(char **str1, char *str2);
char *get_status_message(int status_code);