Modified file hierarchy
This commit is contained in:
parent
21bdb0bdf4
commit
b4247d861f
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
[submodule "src/xlibc"]
|
||||
path = src/xlibc
|
||||
url = https://xavishobbies.org/git/Xavi/xlibc
|
||||
[submodule "src/sqlite3"]
|
||||
path = src/sqlite3
|
||||
url = https://xavishobbies.org/git/Other/sqlite3
|
55
Makefile
Normal file
55
Makefile
Normal file
@ -0,0 +1,55 @@
|
||||
.POSIX:
|
||||
|
||||
SRC_DIR = src
|
||||
OBJ_DIR = obj
|
||||
|
||||
ALL_OBJS = $(wildcard $(OBJ_DIR)/*.o)
|
||||
|
||||
SRC = $(wildcard $(SRC_DIR)/*.c)
|
||||
OBJ = $(addprefix $(OBJ)
|
||||
|
||||
|
||||
X_STRING_DIR = $(SRC_DIR)/xlibc/x_string
|
||||
X_STRING_SRC = $(wildcard $(X_STRING_DIR)/src/*.c)
|
||||
X_STRING_OBJ = $(X_STRING_SRC:.c=.o)
|
||||
|
||||
SQLITE_DIR = $(SRC_DIR)/sqlite3
|
||||
SQLITE_SRC = $(wildcard $(SQLITE_DIR)/src/*.c)
|
||||
SQLITE_OBJ = $(SQLITE_SRC:.c=.o)
|
||||
|
||||
INC_DIRS=$(X_STRING_DIR)/src
|
||||
|
||||
HOME_DIR = $$HOME
|
||||
CONFIG_DIR = /.config/dodo
|
||||
DB_FILE = $(CONFIG_DIR)/dodo.db
|
||||
DFLAGS = -DDB_PATH=\"$(DB_FILE)\"
|
||||
|
||||
|
||||
all: dodo
|
||||
|
||||
$(OBJ): $(X_STRING_OBJ)
|
||||
$(CC) -c -o $(OBJ_DIR)/$(@F) -I./$(INC_DIRS)/ $(DFLAGS) $(SRC)
|
||||
|
||||
$(X_STRING_OBJ):
|
||||
$(CC) -c -o $(OBJ_DIR)/$(@F) $(X_STRING_SRC)
|
||||
|
||||
$(SQLITE_OBJ):
|
||||
$(CC) -c -o $(OBJ_DIR)/$(@F) $(SQLITE_SRC)
|
||||
|
||||
dodo: $(OBJ) $(X_STRING_OBJ) $(SQLITE_OBJ)
|
||||
$(CC) -o $@ $(ALL_OBJS)
|
||||
|
||||
install:
|
||||
mkdir -p $(HOME_DIR)$(CONFIG_DIR)
|
||||
sqlite3 $(HOME_DIR)$(DB_FILE) < dodo.schema
|
||||
|
||||
uninstall:
|
||||
rm -rf $(HOME_DIR)$(CONFIG_DIR)
|
||||
|
||||
clean_all:
|
||||
rm -f dodo $(OBJ)
|
||||
|
||||
clean:
|
||||
rm -f dodo dodo.o x_string.o
|
||||
|
||||
.PHONY: all clean_all clean install uninstall
|
BIN
obj/dodo.o
Normal file
BIN
obj/dodo.o
Normal file
Binary file not shown.
BIN
obj/sqlite3.o
Normal file
BIN
obj/sqlite3.o
Normal file
Binary file not shown.
BIN
obj/x_string.o
Normal file
BIN
obj/x_string.o
Normal file
Binary file not shown.
31095
sqlite3/shell.c
31095
sqlite3/shell.c
File diff suppressed because it is too large
Load Diff
257673
sqlite3/sqlite3.c
257673
sqlite3/sqlite3.c
File diff suppressed because it is too large
Load Diff
13425
sqlite3/sqlite3.h
13425
sqlite3/sqlite3.h
File diff suppressed because it is too large
Load Diff
35
src/Makefile
35
src/Makefile
@ -1,35 +0,0 @@
|
||||
.POSIX:
|
||||
|
||||
|
||||
SRC = dodo.c sqlite3.c x_string.c
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
HOME_DIR = $$HOME
|
||||
CONFIG_DIR = /.config/dodo
|
||||
DB_FILE = $(CONFIG_DIR)/dodo.db
|
||||
DFLAGS = -DDB_PATH=\"$(DB_FILE)\"
|
||||
|
||||
all: dodo
|
||||
|
||||
$(OBJ):
|
||||
|
||||
dodo.o: dodo.c
|
||||
$(CC) -c -o dodo.o -ggdb $(DFLAGS) dodo.c
|
||||
|
||||
dodo: $(OBJ)
|
||||
$(CC) -o $@ $(OBJ)
|
||||
|
||||
install: dodo
|
||||
mkdir -p $(HOME_DIR)$(CONFIG_DIR)
|
||||
sqlite3 $(HOME_DIR)$(DB_FILE) < dodo.schema
|
||||
|
||||
uninstall:
|
||||
rm -rf $(HOME_DIR)$(CONFIG_DIR)
|
||||
|
||||
clean_all:
|
||||
rm -f dodo $(OBJ)
|
||||
|
||||
clean:
|
||||
rm -f dodo dodo.o x_string.o
|
||||
|
||||
.PHONY: all clean_all clean install uninstall
|
1
src/sqlite3
Submodule
1
src/sqlite3
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 584472ad248fbf6818f9c14af79211e6f017e271
|
257673
src/sqlite3.c
257673
src/sqlite3.c
File diff suppressed because it is too large
Load Diff
13425
src/sqlite3.h
13425
src/sqlite3.h
File diff suppressed because it is too large
Load Diff
@ -1,71 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// return the length of string to the null terminator
|
||||
int x_strlen(char* str){
|
||||
char* ptr = str;
|
||||
while(*ptr != '\0'){
|
||||
ptr++;
|
||||
}
|
||||
return ptr - str;
|
||||
}
|
||||
|
||||
// copy one string to another destination
|
||||
// must include the size of the destination
|
||||
void x_strcpy(char* dest, char* src, const int size_dest){
|
||||
char* dest_ptr = dest;
|
||||
char* src_ptr = src;
|
||||
int i = 0;
|
||||
|
||||
while(*src_ptr != '\0'){
|
||||
if (i >= size_dest){
|
||||
fprintf(stderr, "Error: x_strcpy\nSource string exeeds destination memory\n");
|
||||
exit(1);
|
||||
}
|
||||
*dest_ptr = *src_ptr;
|
||||
dest_ptr++;
|
||||
src_ptr++;
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
// compare two strings
|
||||
// return 0 if equal to eachother
|
||||
// return -1 if not
|
||||
int x_strcmp (char* str1, char* str2){
|
||||
char* ptr1 = str1;
|
||||
char* ptr2 = str2;
|
||||
|
||||
while(*ptr1 != '\0' && *ptr2 != '\0'){
|
||||
if(*ptr1 != *ptr2){
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr1++;
|
||||
ptr2++;
|
||||
}
|
||||
|
||||
// if havent reached the end of one of the strings
|
||||
if (*ptr1 != '\0' || *ptr2 != '\0'){
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// concatinate two strings
|
||||
char* x_strconcat(char* str1, char* str2){
|
||||
|
||||
char* new_string;
|
||||
|
||||
int len1 = x_strlen(str1);
|
||||
int len2 = x_strlen(str2);
|
||||
int new_length = len1 + len2;
|
||||
|
||||
new_string = malloc( sizeof(*new_string) * new_length );
|
||||
x_strcpy(new_string, str1, new_length);
|
||||
x_strcpy(&new_string[len1], str2, new_length - len1);
|
||||
|
||||
return new_string;
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
#ifndef X_STRING_H
|
||||
#define X_STRING_H
|
||||
|
||||
int x_strlen(char*);
|
||||
void x_strcpy(char*, char*, const int);
|
||||
int x_strcmp(char*, char*);
|
||||
char* x_strconcat(char*, char*);
|
||||
|
||||
#endif
|
1
src/xlibc
Submodule
1
src/xlibc
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a3a700a2c045a6d55e40ab92fb9e3f3fb4a60848
|
Loading…
Reference in New Issue
Block a user