|
a/src/common/rclinit.cpp |
|
b/src/common/rclinit.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.5 2006-03-29 11:18:14 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: rclinit.cpp,v 1.6 2006-09-08 09:02:47 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
25 |
#include "debuglog.h"
|
25 |
#include "debuglog.h"
|
26 |
#include "rclconfig.h"
|
26 |
#include "rclconfig.h"
|
27 |
#include "rclinit.h"
|
27 |
#include "rclinit.h"
|
28 |
|
28 |
|
29 |
RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
29 |
RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
|
30 |
string &reason)
|
30 |
string &reason, const string *argcnf)
|
31 |
{
|
31 |
{
|
32 |
if (cleanup)
|
32 |
if (cleanup)
|
33 |
atexit(cleanup);
|
33 |
atexit(cleanup);
|
34 |
if (sigcleanup) {
|
34 |
if (sigcleanup) {
|
35 |
if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
|
35 |
if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
|
|
... |
|
... |
41 |
if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
|
41 |
if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
|
42 |
signal(SIGTERM, sigcleanup);
|
42 |
signal(SIGTERM, sigcleanup);
|
43 |
}
|
43 |
}
|
44 |
DebugLog::getdbl()->setloglevel(DEBDEB1);
|
44 |
DebugLog::getdbl()->setloglevel(DEBDEB1);
|
45 |
DebugLog::setfilename("stderr");
|
45 |
DebugLog::setfilename("stderr");
|
46 |
RclConfig *config = new RclConfig;
|
46 |
RclConfig *config = new RclConfig(argcnf);
|
47 |
if (!config || !config->ok()) {
|
47 |
if (!config || !config->ok()) {
|
48 |
reason = "Configuration could not be built:\n";
|
48 |
reason = "Configuration could not be built:\n";
|
49 |
if (config)
|
49 |
if (config)
|
50 |
reason += config->getReason();
|
50 |
reason += config->getReason();
|
51 |
else
|
51 |
else
|