From e0a8b233c2edef848e5fe084931fc780cc1cb87e Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Sat, 19 Nov 2016 12:15:39 +0200 Subject: [PATCH] Move the main function to main.c Move the main function to main.c in the git root to allow for alternative main functions to be linked in its place. Specifically this will be used to link the test runner main to run tests. --- Makefile | 6 +++--- main.c | 7 +++++++ src/dunst.c | 2 +- src/dunst.h | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 main.c diff --git a/Makefile b/Makefile index c81b28d..0e4f604 100644 --- a/Makefile +++ b/Makefile @@ -33,9 +33,9 @@ config.h: config.def.h @echo creating $@ from $< @cp $< $@ -dunst: ${OBJ} +dunst: ${OBJ} main.o @echo "${CC} ${CFLAGS} -o $@ ${OBJ} ${LDFLAGS}" - @${CC} ${CFLAGS} -o $@ ${OBJ} ${LDFLAGS} + @${CC} ${CFLAGS} -o $@ ${OBJ} main.o ${LDFLAGS} dunstify: @${CC} ${CFLAGS} -o $@ dunstify.c -std=c99 $(shell pkg-config --libs --cflags glib-2.0 libnotify) @@ -45,7 +45,7 @@ debug: ${OBJ} @${CC} ${CFLAGS} -O0 -o dunst ${OBJ} ${LDFLAGS} clean-dunst: - rm -f dunst ${OBJ} + rm -f dunst ${OBJ} main.o rm -f org.knopwob.dunst.service clean-dunstify: diff --git a/main.c b/main.c new file mode 100644 index 0000000..e31b420 --- /dev/null +++ b/main.c @@ -0,0 +1,7 @@ +#include "src/dunst.h" + +int main(int argc, char *argv[]) +{ + return dunst_main(argc, argv); +} +/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ diff --git a/src/dunst.c b/src/dunst.c index a0debc0..11d347b 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -313,7 +313,7 @@ static void teardown(void) x_free(); } -int main(int argc, char *argv[]) +int dunst_main(int argc, char *argv[]) { history = g_queue_new(); diff --git a/src/dunst.h b/src/dunst.h index 805cb50..b2bc025 100644 --- a/src/dunst.h +++ b/src/dunst.h @@ -35,6 +35,8 @@ extern const char *color_strings[3][3]; gboolean run(void *data); void wake_up(void); +int dunst_main(int argc, char *argv[]); + void check_timeouts(void); void history_pop(void); void history_push(notification *n);