From ce5509008f85738a194858108f394d12d0fe251a Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Fri, 3 Jul 2009 02:27:16 -0300 Subject: [PATCH] Add option to make program run in foreground. --- popproxy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/popproxy.c b/popproxy.c index 78403ba..0f01f35 100644 --- a/popproxy.c +++ b/popproxy.c @@ -61,11 +61,14 @@ new_client (int fd, struct sockaddr *addr, socklen_t saddr, gpointer data) } static gchar *configfile; +static gboolean foreground; static GOptionEntry opt_entries[] = { { "config-file", 'c', 0, G_OPTION_ARG_FILENAME, &configfile, "Configuration file location", "file" }, + { "foreground", 'f', 0, G_OPTION_ARG_NONE, &foreground, + "Run in foreground", 0 }, { NULL } }; @@ -152,7 +155,8 @@ int main (int argc, char **argv) g_message ("Listening at %s:%s.", conf_address, port); - daemon (0, 0); + if (!foreground) + daemon (0, 0); g_free (conf_address); g_free (port); -- 2.20.1