commit 969f4e26b8735f4e21ab9ca9894e737c8c9ba242 Author: auric Date: Thu Feb 22 13:54:52 2024 -0600 Begin writing it... Better late than never diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..53624c9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3800835 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +SRCd := src +BINd := bin +OBJd := obj +INCd := inc +CC = gcc +LDFLAGS = +CFLAGS = -Iinclude -Iinc -Wall -O2 -g + +SRC = $(wildcard $(SRCd)/*.c) +OBJ = $(SRC:$(SRCd)/%.c=$(OBJd)/%.o) +TARGETS = $(SRC:$(SRCd)/%.c=$(BINd)/%) + +main: $(OBJ) $(OBJd)/nprint.o # The option of a single program instead of a suite. WARN: Requires modification of source to remove multiple main() + $(CC) $(LDFLAGS) -o $(BINd)/fex $^ + +multi: $(TARGETS) + +$(BINd)/%: $(OBJd)/%.o $(OBJd)/nprint.o + $(CC) $(LDFLAGS) -o $@ $^ + +$(OBJd)/%.o: $(SRCd)/%.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJd)/nprint.o: $(INCd)/nprint.c $(INCd)/nprint.h + $(CC) $(CFLAGS) -c $< -o $@ + + +clean: + rm -f $(OBJd)/*.o $(BINd)/* + +.PHONY: all clean \ No newline at end of file diff --git a/bin/fex b/bin/fex new file mode 100755 index 0000000..8f1149c Binary files /dev/null and b/bin/fex differ diff --git a/bin/install b/bin/install new file mode 100755 index 0000000..2df8112 Binary files /dev/null and b/bin/install differ diff --git a/inc/nprint.c b/inc/nprint.c new file mode 100644 index 0000000..ca563bc --- /dev/null +++ b/inc/nprint.c @@ -0,0 +1,49 @@ +// +// Created by auric on 2/21/24. +// + +#include "nprint.h" +#include + +void nprint(const char *tag, const char *format, ...) { + const char *color = ""; + const char *bgcolor = ""; + const char *reset = "\033[0m"; + va_list args; + + switch(*tag) { + case 'X': + color = "\033[1;30m"; + bgcolor = "\033[43m"; + break; + case 'E': + color = "\033[1;31m"; + break; + case 'S': + color = "\033[1;32m"; + break; + case 'W': + color = "\033[1;33m"; + break; + case 'I': + color = "\033[1;34m"; + break; + case 'D': + color = "\033[1;35m"; + break; + case 'Y': + color = "\033[1;35m"; + bgcolor = "\033[43m"; + break; + default: + color = "\033[1m"; + } + + printf("[%s%s%s%s] ", bgcolor, color, tag, reset); + + va_start(args, format); + vprintf(format, args); + va_end(args); + + printf("\n"); +} diff --git a/inc/nprint.h b/inc/nprint.h new file mode 100644 index 0000000..336b4a9 --- /dev/null +++ b/inc/nprint.h @@ -0,0 +1,12 @@ +// +// Created by auric on 2/21/24. +// + +#ifndef NPRINT_H +#define NPRINT_H + +#include + +void nprint(const char *tag, const char *format, ...); + +#endif //NPRINT_H diff --git a/inc/sanity.h b/inc/sanity.h new file mode 100644 index 0000000..c41bc2b --- /dev/null +++ b/inc/sanity.h @@ -0,0 +1,12 @@ +// +// Created by auric on 2/22/24. +// + +#ifndef SANITY_H +#define SANITY_H + +# include + +int sanity_check(); + +#endif //SANITY_H diff --git a/obj/fex.o b/obj/fex.o new file mode 100644 index 0000000..b255e9a Binary files /dev/null and b/obj/fex.o differ diff --git a/obj/install.o b/obj/install.o new file mode 100644 index 0000000..cb51599 Binary files /dev/null and b/obj/install.o differ diff --git a/obj/nprint.o b/obj/nprint.o new file mode 100644 index 0000000..4880fa1 Binary files /dev/null and b/obj/nprint.o differ diff --git a/obj/sanity.o b/obj/sanity.o new file mode 100644 index 0000000..cbc6b22 Binary files /dev/null and b/obj/sanity.o differ diff --git a/src/fex.c b/src/fex.c new file mode 100644 index 0000000..00fe3b4 --- /dev/null +++ b/src/fex.c @@ -0,0 +1,36 @@ +// +// Created by auric on 2/21/24. +// + +#include +#include +#include +#include + +char* opt = NULL; +void help() { + nprint("E", "Usage: fex (OPT) (PACKAGES)"); +} +int main(int argc, char** argv) { + if (argc < 2) { + help(); + return 1; + } + + if (argv[1][0] == '-' || argv[1][0] == '+' ) { + opt = argv[1]; + } else { + nprint("E", "First argument must be OPT"); + return 1; + } + + if (opt[0] == '+' && opt[1] != '\0') { + nprint("D", "Placeholder"); + } + + if (argc < 3) { + nprint("E", "No packages specified"); + return 1; + } + return 0; +} \ No newline at end of file diff --git a/src/install.c b/src/install.c new file mode 100644 index 0000000..c13d784 --- /dev/null +++ b/src/install.c @@ -0,0 +1,15 @@ +/* + Created by auric on 2/21/24. + +*/ + +#include +#include +#include +#include +/* Prototype main for suite instead of a unified manager. Obviously never developed +int main() { + nprint("I", "Information"); +} + */ + diff --git a/src/sanity.c b/src/sanity.c new file mode 100644 index 0000000..5292b3c --- /dev/null +++ b/src/sanity.c @@ -0,0 +1,28 @@ +// +// Created by auric on 2/22/24. +// + +/* + * 0: Success + * 1: Failure + * 2: Root check failure + * 3: /con check failure + * 4: /exe check filuse + * 5: /con and /exe check failure + */ + +#include +#include + +bool isSane = true; +bool isRoot = false; + +int sanity_check() { + if (getuid() == 0) { + isRoot = true; + } + + + + return 0; +} \ No newline at end of file