From 1cbff62e489bf79c2b313fb2236b123bb39de210 Mon Sep 17 00:00:00 2001 From: Emil Date: Wed, 2 Aug 2023 09:48:30 -0600 Subject: [PATCH] Removes all the warnings --- GNUmakefile | 46 ---------------------------------------------- Makefile | 44 -------------------------------------------- build.sh | 4 ++-- src/main.c | 4 ++-- src/parse.c | 36 +++++++++++++++++++++++++++++++++++- 5 files changed, 39 insertions(+), 95 deletions(-) delete mode 100644 GNUmakefile delete mode 100644 Makefile diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100644 index 227c925..0000000 --- a/GNUmakefile +++ /dev/null @@ -1,46 +0,0 @@ -.POSIX: # Just kidding, use GNU Make - -# OVERRIDE ME # -PREFIX := . -PROGN := probotic - -CC := cc -CFLAGS := -std=c99 -Wall -Wextra -Wpedantic -CPPFLAGS := -I/usr/bin/ircclient/ -Iinclude -LDFLAGS := -lircclient - -SRC.DIR := src -OBJ.DIR := $(PREFIX)/obj -INC.DIR := include - -OBJ := $(addprefix $(OBJ.DIR)/,fetch.o main.o parse.o) -HDR := config.h utils.h parse.h - -VPATH := $(INC.DIR) $(SRC.DIR) $(OBJ.DIR) - -ifeq ($(DEBUG),1) - CFLAGS += -Og -g3 -else - CFLAGS += -O3 -flto=auto -fomit-frame-pointer -endif - -ifdef SAN - CFLAGS += -fsanitize=$(SAN) -endif - -CPPFLAGS += -DPROGN="\"$(PROGN)\"" - -$(OBJ.DIR)/%.o: $(SRC.DIR)/%.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -$(PREFIX)/$(PROGN): $(VPATH) $(PREFIX) $(HDR) | $(OBJ) - $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $| $(LDFLAGS) - -include/config.h: include/config.mk.h - cp -f $< $@ - -$(VPATH) $(PREFIX): - mkdir -p $@ - -clean: - $(RM) $(OBJ) $(PROGN) diff --git a/Makefile b/Makefile deleted file mode 100644 index c6e8e2e..0000000 --- a/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# OVERRIDE ME # -PROGN := probotic - -CC := cc -CFLAGS := -std=c99 -Wall -Wextra -Wpedantic -CPPFLAGS := -I/usr/bin/ircclient/ -Iinclude -LDFLAGS := -lircclient - -SRC.DIR := src -OBJ.DIR := obj -INC.DIR := include - -SRC := fetch.c main.c parse.c -OBJ := fetch.o main.o parse.o -HDR := config.h utils.h parse.h - -VPATH := ${INC.DIR}:${SRC.DIR}:${OBJ.DIR} - -.if "${DEBUG}" == "1" -CFLAGS := ${CFLAGS} -Og -g3 -.else -CFLAGS := ${CFLAGS} -O3 -flto=auto -fomit-frame-pointer -.endif - -.ifdef SAN -CFLAGS := ${CFLAGS} -fsanitize=${SAN} -.endif - -CPPFLAGS := ${CPPFLAGS} -DPROGN="\"${PROGN}\"" - -.c.o: - ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $< - -${PROGN}: ${OBJ.DIR} ${HDR} ${OBJ} - ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ ${OBJ} ${LDFLAGS} - -include/config.h: include/config.mk.h - cp -f $< $@ - -${OBJ.DIR}: - mkdir -p $@ - -clean: - ${RM} ${OBJ} ${PROGN} diff --git a/build.sh b/build.sh index 1a4e7a8..b4c6763 100755 --- a/build.sh +++ b/build.sh @@ -8,8 +8,8 @@ PROGN=${PROGN:-probotic} PREFIX=${PREFIX:-$DIR} CC=${CC-cc} -CFLAGS='-std=c99 -Wall -Wextra -Wpedantic' -CPPFLAGS='-I/usr/bin/ircclient/ -Iinclude' +CFLAGS='-std=c99 -Wall -Wextra -Wpedantic -Wno-unused-parameter' +CPPFLAGS="-I/usr/bin/ircclient/ -Iinclude -D_GNU_SOURCE -DPROGN=\"$PROGN\"" LDFLAGS='-lircclient' mkdir -p $PREFIX && echo "Made directory: $PREFIX" diff --git a/src/main.c b/src/main.c index 68a45f3..a0bcc09 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,5 @@ /* @COMPILECMD ../unity.sh */ -#define _GNU_SOURCE - #include #include #include @@ -64,6 +62,8 @@ event_channel(irc_session_t * session, { const char * channel = params[0]; const char * message = params[1]; + (void) channel; + (void) message; char * swp = get_username(origin); msg_wrapper("%s, you are a faggot for this opinion.", swp); diff --git a/src/parse.c b/src/parse.c index af700cf..3e4df32 100644 --- a/src/parse.c +++ b/src/parse.c @@ -1,12 +1,46 @@ #include #include +#include -#include "creds_parser.h" +#include "parse.h" #include "utils.h" /* possibly globalize creds so that we can ensure by using atexit that it is always cleansed? */ +/* these are closer described as 'setters', no? */ + +int parse_remind(char const * arg) +{ + (void) arg; + ERRMSG("not implemented"); + return 0; +} + +int parse_repo(char const * arg) +{ + (void) arg; + ERRMSG("not implemented"); + return 0; +} + +int +parse_command(char const * command, + const char * arg /* NULLABLE */) +{ + /* I know. */ +#define COMMAND(cmd,fn) if (strcmp(command,cmd) == 0) { return fn(arg); } else + COMMAND("remind", parse_remind) + COMMAND("repo", parse_repo) + /* COMMAND("raw", sql_execute?) */ + /* COMMAND("post", parse_post) */ + /* COMMAND("prune", parse_prune) */ + /* COMMAND("search", parse_search) */ + /* COMMAND("list", parse_list) */ + { ERR(1,"No such command.\n"); } +#undef COMMAND +} + int parse_creds(creds_t * creds, char const * creds_file)