From: Thadeu Lima de Souza Cascardo Date: Fri, 3 Jul 2009 05:27:16 +0000 (-0300) Subject: Add option to make program run in foreground. X-Git-Tag: v0.1.3~48 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Frnetproxy.git;a=commitdiff_plain;h=ce5509008f85738a194858108f394d12d0fe251a Add option to make program run in foreground. --- 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);