From 81f172648a43671b1774c4e80de84f721f54b5e4 Mon Sep 17 00:00:00 2001 From: Emil Date: Wed, 2 Aug 2023 04:57:45 -0600 Subject: [PATCH] added basic files --- build.sh | 24 ++++++++++++++++++++++++ src/fetch.c | 30 ++++++++++++++++++++++++++++++ src/main.c | 6 ++++++ src/unity.c | 2 ++ 4 files changed, 62 insertions(+) create mode 100755 build.sh create mode 100644 src/fetch.c create mode 100644 src/main.c create mode 100644 src/unity.c diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..809381c --- /dev/null +++ b/build.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# Simple script handling unity builds and options. + +DIR=$(dirname $(readlink -f "$0")) +cd $DIR + +PROGN=${PROGN:-dc} +PREFIX=${PREFIX:-$DIR} + +CC=${CC-cc} +CFLAGS='-std=c99 -Wall -Wextra -Wpedantic' +CPPFLAGS='-Iinclude' +LDFLAGS='-lgmp -lreadline' + +mkdir -p $PREFIX && echo "Made directory: $PREFIX" + +if [ ! -z ${DEBUG} ] ; then CFLAG="$CFLAGS -Og -g3"; + else CFLAG="$CFLAGS -O2 -flto=auto -fomit-frame-pointer"; fi + +[ ! -z ${SAN} ] && CFLAG="$CFLAGS -fsanitize=$SAN" + +echo "$CC $CFLAGS -pipe $DIR/src/unity.c -o $PREFIX/$PROGN $CPPFLAGS $LDFLAGS" +$CC $CFLAGS -pipe $DIR/src/unity.c -o $PREFIX/$PROGN $CPPFLAGS $LDFLAGS +echo "\nStatus: $?" diff --git a/src/fetch.c b/src/fetch.c new file mode 100644 index 0000000..e3c3384 --- /dev/null +++ b/src/fetch.c @@ -0,0 +1,30 @@ +/* fetch.c - fetch from file */ + +#include + +#ifdef LOCAL_PROBOTIC_MAIN + +int +main (int argc, + char ** argv) +{ + if (argc > 1) + { + char * b; + /* get week number via stoi */ + ++argv; --argc; + /* no options, yet */ + while (++argv, --argc) + { + printf("%s\n", *argv); + } + } + else + { + /* no stdin yet */ + /* usage(); */ + return 1; + } +} + +#endif /* LOCAL_PROBOTIC_MAIN */ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..7114a90 --- /dev/null +++ b/src/main.c @@ -0,0 +1,6 @@ +/* main.c - this file would handle the bot? */ + +int main(void) +{ + return 0; +} diff --git a/src/unity.c b/src/unity.c new file mode 100644 index 0000000..42308d5 --- /dev/null +++ b/src/unity.c @@ -0,0 +1,2 @@ +#include "fetch.c" +#include "main.c"