From 1b80b589b755543f86fe5849e2992ad057684d15 Mon Sep 17 00:00:00 2001 From: nekobit Date: Wed, 24 Aug 2022 13:59:48 +0000 Subject: [PATCH] Debug options FossilOrigin-Name: 00a884ba50b3a7a8d5e002ab07eef2430a705d60c789fa434a578c8f73920134 --- Makefile | 4 ++++ src/main.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/Makefile b/Makefile index 499bf5d..9340e2a 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,10 @@ ifneq ($(strip $(SINGLE_THREADED)),) CFLAGS += -DSINGLE_THREADED endif +ifneq ($(strip $(SINGLE_THREADED)),) +CFLAGS += -DDEBUG +endif + all: $(MAKE) dep_build $(MAKE) filec diff --git a/src/main.c b/src/main.c index 4e2b0b9..2a58434 100644 --- a/src/main.c +++ b/src/main.c @@ -54,6 +54,13 @@ static void xs_init (pTHX); EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); +#ifdef DEBUG +static void exit_treebird(PATH_ARGS) +{ + exit(0); +} +#endif + /******************* * Path handling * ******************/ @@ -109,6 +116,10 @@ static struct path_info paths[] = { { "/tag/:", content_tl_tag }, { "/chats/:", content_chat_view }, { "/chats", content_chats }, +#ifdef DEBUG + { "/quit", exit_treebird }, + { "/exit", exit_treebird }, +#endif // API { "/treebird_api/v1/notifications", api_notifications }, { "/treebird_api/v1/interact", api_status_interact },