Commit 65653f5d authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(foreground): New static variable.

(sighandler_winch): Moved log message to toploop().  (Bug 692).
(go_daemon): Stay in foreground if given -f, not -d.
(initialize): Prompt the operator for confirmation when given -f, not -d.
(main): Ditto.  Handle -f: stay in foreground.
parent bc11d904
/*
* $Id: ramkomd.c,v 0.103 2002/09/10 08:48:47 ceder Exp $
* $Id: ramkomd.c,v 0.104 2002/10/23 09:03:19 ceder Exp $
* Copyright (C) 1991-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -130,6 +130,11 @@ time_t current_time = 0;
int buglevel = 0;
#endif
/* Don't place lyskomd in the background. Write the log to stdout.
Prompt for input on stdin before exiting. This is primarily
intended for debugging and the test suite. */
static int foreground = 0;
static IscSession *listen_client = NULL; /* ISC listen identifier */
static void dump_exit_statistics(void);
......@@ -264,7 +269,6 @@ sighandler_winch(int UNUSED(sig))
#ifndef HAVE_STRUCT_SIGACTION
signal(SIGWINCH, sighandler_winch);
#endif
kom_log("Signal WINCH received. Will re-read config now.\n");
reread_param = TRUE;
}
......@@ -289,7 +293,7 @@ go_daemon(void)
struct sigaction act;
#endif
if (buglevel != 0)
if (foreground != 0)
{
return;
}
......@@ -446,7 +450,7 @@ initialize(const char *config_file)
but is could also be useful to be able to attach a debugger and
do pre-mortem debugging of the process at this point. */
kom_log("Cannot obtain database lock. Exiting.\n");
if (buglevel > 0)
if (foreground)
{
kom_log("Press enter to terminate lyskomd\n");
getchar();
......@@ -517,8 +521,12 @@ main (int argc,
buglevel++;
break;
case 'f':
foreground = 1;
break;
default:
restart_kom("usage: %s [-d ...] [config-file]\n", argv[0]);
restart_kom("usage: %s [-f] [-d ...] [config-file]\n", argv[0]);
}
......@@ -590,7 +598,7 @@ main (int argc,
mode. This is mainly here for the benefit of the test suite,
but is could also be useful to be able to attach a debugger and
do pre-mortem debugging of the process at this point. */
if (buglevel > 0)
if (foreground)
{
kom_log("Press enter to terminate lyskomd\n");
getchar();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment