From b6436e0ef6029c6cf002bc5fea599f64253cb206 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Fri, 25 Sep 2026 21:38:58 -0500 Subject: init --- .gitignore | 2 ++ .gitmodules | 6 ++++++ build.sh | 22 ++++++++++++++++++++++ compile_flags.txt | 2 ++ libs/iceys-c-libs | 1 + libs/socket | 1 + public_html/beans.html | 10 ++++++++++ public_html/index.html | 9 +++++++++ src/main.c | 41 +++++++++++++++++++++++++++++++++++++++++ 9 files changed, 94 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100755 build.sh create mode 100644 compile_flags.txt create mode 160000 libs/iceys-c-libs create mode 160000 libs/socket create mode 100755 public_html/beans.html create mode 100755 public_html/index.html create mode 100755 src/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a0795f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/** +obj/** diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..efc6035 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "libs/iceys-c-libs"] + path = libs/iceys-c-libs + url = https://git.iceyfox.xyz/iceyrazor/iceys-c-libs +[submodule "libs/socket"] + path = libs/socket + url = https://git.iceyfox.xyz/iceyrazor/socket diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..3dfb60a --- /dev/null +++ b/build.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +DEBUG_FLAGS="" +LIB="-Ilibs/iceys-c-libs -Ilibs/socket" + +mkdir -p bin +mkdir -p obj + +while getopts "d" opt; do + case "$opt" in + d) DEBUG_FLAGS="-Wall -fsanitize=address -g" + ;; + esac +done + +shift $((OPTIND-1)) +[ "${1:-}" = "--" ] && shift + +printf "\n\nmaking project\n" +clang -Ilibs/iceys-c-libs -c libs/iceys-c-libs/iceys-utils.c -o obj/iceys-utils.o +clang obj/iceys-utils.o -o bin/Server src/main.c $LIB $DEBUG_FLAGS -lm \ No newline at end of file diff --git a/compile_flags.txt b/compile_flags.txt new file mode 100644 index 0000000..edd63a2 --- /dev/null +++ b/compile_flags.txt @@ -0,0 +1,2 @@ +-I/home/iceyrazor/stuff/scripts/c/my_utils/socket +-Ilibs/iceys-c-libs \ No newline at end of file diff --git a/libs/iceys-c-libs b/libs/iceys-c-libs new file mode 160000 index 0000000..a5e1191 --- /dev/null +++ b/libs/iceys-c-libs @@ -0,0 +1 @@ +Subproject commit a5e1191ad6c34636eb49c0ddaeb9af1bd5c07a2d diff --git a/libs/socket b/libs/socket new file mode 160000 index 0000000..7e287a8 --- /dev/null +++ b/libs/socket @@ -0,0 +1 @@ +Subproject commit 7e287a8ca7164e871965339196511fdcf0248921 diff --git a/public_html/beans.html b/public_html/beans.html new file mode 100755 index 0000000..c930946 --- /dev/null +++ b/public_html/beans.html @@ -0,0 +1,10 @@ + + + + beans + + +

beans

+

ビーンズ

+ + diff --git a/public_html/index.html b/public_html/index.html new file mode 100755 index 0000000..f6fc9d9 --- /dev/null +++ b/public_html/index.html @@ -0,0 +1,9 @@ + + + +basic + + +

HI

+ + diff --git a/src/main.c b/src/main.c new file mode 100755 index 0000000..47619e5 --- /dev/null +++ b/src/main.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include + +// dont use stdio in these +sig_atomic_t running = 1; +void sig_int_handler(int num) +{ + running = 0; +} + +int main(int argc, char* argv[]) +{ + if (argc<2){ + fprintf(stderr, "arg1 must be set for port\n"); + exit(-1); + } + int port = atoi(argv[1]); + if (port == 0) { + fprintf(stderr, "port must not be 0\n"); + exit(-1); + } + + struct Server server = server_constructor(AF_INET, SOCK_STREAM, 0, INADDR_ANY, port, 10, launch); + server.html_folder = "./public_html/"; + + struct sigaction act = { 0 }; + act.sa_handler = &sig_int_handler; + sigaction(SIGINT, &act, NULL); + + server.launch(&server); + + while (running) { } + + usleep(1); + server_close(&server); + + return 0; +} \ No newline at end of file -- cgit v1.3