2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-10-16 19:03:49 +00:00
|
|
|
#include "cpp.h"
|
2004-03-04 11:41:43 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2004-06-16 23:16:08 +00:00
|
|
|
#include "boinc_win.h"
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _WIN32
|
2005-11-21 18:34:44 +00:00
|
|
|
#include "config.h"
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
2007-10-10 15:57:59 +00:00
|
|
|
#include <unistd.h>
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
#include "error_numbers.h"
|
2006-09-01 21:06:30 +00:00
|
|
|
#include "common_defs.h"
|
2002-08-12 23:18:47 +00:00
|
|
|
#include "file_names.h"
|
2004-04-08 08:15:23 +00:00
|
|
|
#include "client_msgs.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "parse.h"
|
2008-02-07 17:46:56 +00:00
|
|
|
#include "str_util.h"
|
2004-03-01 19:11:12 +00:00
|
|
|
#include "filesys.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2007-10-20 16:10:57 +00:00
|
|
|
using std::string;
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
LOG_FLAGS log_flags;
|
2006-05-21 21:11:28 +00:00
|
|
|
CONFIG config;
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
LOG_FLAGS::LOG_FLAGS() {
|
2003-03-13 21:49:52 +00:00
|
|
|
|
2006-06-22 19:40:30 +00:00
|
|
|
memset(this, 0, sizeof(LOG_FLAGS));
|
|
|
|
|
2007-04-26 21:57:42 +00:00
|
|
|
defaults();
|
|
|
|
}
|
|
|
|
|
|
|
|
void LOG_FLAGS::defaults() {
|
2006-06-22 19:40:30 +00:00
|
|
|
// on by default
|
|
|
|
// (others are off by default)
|
2003-03-13 21:49:52 +00:00
|
|
|
//
|
2006-06-22 19:40:30 +00:00
|
|
|
task = true;
|
2003-03-13 21:49:52 +00:00
|
|
|
file_xfer = true;
|
|
|
|
sched_ops = true;
|
2007-04-26 21:57:42 +00:00
|
|
|
|
|
|
|
// off by default; intended for developers and testers
|
|
|
|
//
|
|
|
|
cpu_sched = false;
|
|
|
|
cpu_sched_debug = false;
|
|
|
|
rr_simulation = false;
|
|
|
|
debt_debug = false;
|
|
|
|
task_debug = false;
|
|
|
|
work_fetch_debug = false;
|
|
|
|
unparsed_xml = false;
|
|
|
|
state_debug = false;
|
|
|
|
file_xfer_debug = false;
|
|
|
|
sched_op_debug = false;
|
|
|
|
http_debug = false;
|
|
|
|
proxy_debug = false;
|
|
|
|
time_debug = false;
|
|
|
|
http_xfer_debug = false;
|
|
|
|
benchmark_debug = false;
|
|
|
|
poll_debug = false;
|
|
|
|
guirpc_debug = false;
|
|
|
|
scrsave_debug = false;
|
|
|
|
app_msg_send = false;
|
|
|
|
app_msg_receive = false;
|
|
|
|
mem_usage_debug = false;
|
|
|
|
network_status_debug = false;
|
|
|
|
checkpoint_debug = false;
|
|
|
|
}
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2002-07-15 23:21:20 +00:00
|
|
|
// Parse log flag preferences
|
|
|
|
//
|
2006-08-21 22:25:21 +00:00
|
|
|
int LOG_FLAGS::parse(XML_PARSER& xp) {
|
|
|
|
char tag[1024];
|
|
|
|
bool is_tag;
|
|
|
|
|
2006-08-23 03:34:30 +00:00
|
|
|
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
2006-08-21 22:25:21 +00:00
|
|
|
if (!is_tag) {
|
2007-01-25 23:39:06 +00:00
|
|
|
msg_printf(NULL, MSG_USER_ERROR,
|
2006-08-21 22:25:21 +00:00
|
|
|
"Unexpected text %s in %s", tag, CONFIG_FILE
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
2006-06-21 22:08:20 +00:00
|
|
|
if (!strcmp(tag, "/log_flags")) return 0;
|
2007-06-08 07:55:27 +00:00
|
|
|
if (xp.parse_bool(tag, "task", task)) continue;
|
|
|
|
if (xp.parse_bool(tag, "file_xfer", file_xfer)) continue;
|
|
|
|
if (xp.parse_bool(tag, "sched_ops", sched_ops)) continue;
|
|
|
|
if (xp.parse_bool(tag, "cpu_sched", cpu_sched)) continue;
|
|
|
|
if (xp.parse_bool(tag, "cpu_sched_debug", cpu_sched_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "rr_simulation", rr_simulation)) continue;
|
|
|
|
if (xp.parse_bool(tag, "debt_debug", debt_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "task_debug", task_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "work_fetch_debug", work_fetch_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "unparsed_xml", unparsed_xml)) continue;
|
|
|
|
if (xp.parse_bool(tag, "state_debug", state_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "file_xfer_debug", file_xfer_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "sched_op_debug", sched_op_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "http_debug", http_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "proxy_debug", proxy_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "time_debug", time_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "http_xfer_debug", http_xfer_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "benchmark_debug", benchmark_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "poll_debug", poll_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "guirpc_debug", guirpc_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "scrsave_debug", scrsave_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "app_msg_send", app_msg_send)) continue;
|
|
|
|
if (xp.parse_bool(tag, "app_msg_receive", app_msg_receive)) continue;
|
|
|
|
if (xp.parse_bool(tag, "mem_usage_debug", mem_usage_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "network_status_debug", network_status_debug)) continue;
|
|
|
|
if (xp.parse_bool(tag, "checkpoint_debug", checkpoint_debug)) continue;
|
2008-10-03 21:55:34 +00:00
|
|
|
if (xp.parse_bool(tag, "coproc_debug", coproc_debug)) continue;
|
2007-06-08 07:55:27 +00:00
|
|
|
msg_printf(NULL, MSG_USER_ERROR, "Unrecognized tag in %s: <%s>\n",
|
|
|
|
CONFIG_FILE, tag
|
|
|
|
);
|
2007-07-03 21:55:50 +00:00
|
|
|
xp.skip_unexpected(tag, true, "LOG_FLAGS::parse");
|
2006-05-21 21:11:28 +00:00
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
|
|
|
|
2006-09-07 17:38:54 +00:00
|
|
|
static void show_flag(char* buf, bool flag, const char* flag_name) {
|
|
|
|
if (!flag) return;
|
2006-09-07 18:19:25 +00:00
|
|
|
int n = (int)strlen(buf);
|
2006-09-07 17:38:54 +00:00
|
|
|
if (!n) {
|
|
|
|
strcpy(buf, flag_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
strcat(buf, ", ");
|
|
|
|
strcat(buf, flag_name);
|
|
|
|
if (strlen(buf) > 60) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "log flags: %s", buf);
|
|
|
|
strcpy(buf, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LOG_FLAGS::show() {
|
|
|
|
char buf[256];
|
|
|
|
strcpy(buf, "");
|
|
|
|
show_flag(buf, task, "task");
|
|
|
|
show_flag(buf, file_xfer, "file_xfer");
|
|
|
|
show_flag(buf, sched_ops, "sched_ops");
|
|
|
|
show_flag(buf, cpu_sched, "cpu_sched");
|
|
|
|
show_flag(buf, cpu_sched_debug, "cpu_sched_debug");
|
|
|
|
show_flag(buf, rr_simulation, "rr_simulation");
|
|
|
|
show_flag(buf, debt_debug, "debt_debug");
|
|
|
|
show_flag(buf, task_debug, "task_debug");
|
|
|
|
show_flag(buf, work_fetch_debug, "work_fetch_debug");
|
|
|
|
show_flag(buf, unparsed_xml, "unparsed_xml");
|
|
|
|
show_flag(buf, state_debug, "state_debug");
|
|
|
|
show_flag(buf, file_xfer_debug, "file_xfer_debug");
|
|
|
|
show_flag(buf, sched_op_debug, "sched_op_debug");
|
|
|
|
show_flag(buf, http_debug, "http_debug");
|
|
|
|
show_flag(buf, proxy_debug, "proxy_debug");
|
|
|
|
show_flag(buf, time_debug, "time_debug");
|
|
|
|
show_flag(buf, http_xfer_debug, "http_xfer_debug");
|
2007-02-06 20:43:54 +00:00
|
|
|
show_flag(buf, benchmark_debug, "benchmark_debug");
|
2006-09-07 17:38:54 +00:00
|
|
|
show_flag(buf, poll_debug, "poll_debug");
|
|
|
|
show_flag(buf, guirpc_debug, "guirpc_debug");
|
|
|
|
show_flag(buf, scrsave_debug, "scrsave_debug");
|
2006-11-21 00:45:22 +00:00
|
|
|
show_flag(buf, app_msg_send, "app_msg_send");
|
|
|
|
show_flag(buf, app_msg_receive, "app_msg_receive");
|
2006-09-07 17:38:54 +00:00
|
|
|
show_flag(buf, mem_usage_debug, "mem_usage_debug");
|
|
|
|
show_flag(buf, network_status_debug, "network_status_debug");
|
2007-02-22 16:33:37 +00:00
|
|
|
show_flag(buf, checkpoint_debug, "checkpoint_debug");
|
2008-10-03 21:55:34 +00:00
|
|
|
show_flag(buf, coproc_debug, "coproc_debug");
|
2006-09-07 17:38:54 +00:00
|
|
|
if (strlen(buf)) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "log flags: %s", buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-21 21:11:28 +00:00
|
|
|
CONFIG::CONFIG() {
|
2007-04-26 21:57:42 +00:00
|
|
|
defaults();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CONFIG::defaults() {
|
2006-05-22 09:54:31 +00:00
|
|
|
dont_check_file_sizes = false;
|
2007-04-26 21:57:42 +00:00
|
|
|
http_1_0 = false;
|
2006-05-21 21:11:28 +00:00
|
|
|
save_stats_days = 30;
|
2007-10-20 16:10:57 +00:00
|
|
|
ncpus = 0;
|
2006-10-25 16:54:47 +00:00
|
|
|
max_file_xfers = MAX_FILE_XFERS;
|
|
|
|
max_file_xfers_per_project = MAX_FILE_XFERS_PER_PROJECT;
|
2007-10-20 16:10:57 +00:00
|
|
|
suppress_net_info = false;
|
|
|
|
disallow_attach = false;
|
|
|
|
os_random_only = false;
|
|
|
|
no_alt_platform = false;
|
|
|
|
simple_gui_only = false;
|
|
|
|
dont_contact_ref_site = false;
|
2007-10-24 22:48:47 +00:00
|
|
|
max_stdout_file_size = 0;
|
|
|
|
max_stderr_file_size = 0;
|
2007-10-20 16:10:57 +00:00
|
|
|
alt_platforms.clear();
|
2007-11-21 19:57:40 +00:00
|
|
|
report_results_immediately = false;
|
2007-12-27 21:40:20 +00:00
|
|
|
start_delay = 0;
|
2008-01-13 00:12:14 +00:00
|
|
|
run_apps_manually = false;
|
2008-02-07 16:05:56 +00:00
|
|
|
force_auth = "default";
|
2008-09-29 16:47:10 +00:00
|
|
|
allow_multiple_clients = false;
|
|
|
|
use_certs = false;
|
|
|
|
use_certs_only = false;
|
|
|
|
exclusive_apps.clear();
|
2008-10-14 23:07:40 +00:00
|
|
|
client_version_check_url = "http://boinc.berkeley.edu/download.php?xml=1";
|
|
|
|
client_download_url = "http://boinc.berkeley.edu/download.php";
|
|
|
|
network_test_url = "http://www.google.com/";
|
2008-12-16 00:09:51 +00:00
|
|
|
no_gpus = false;
|
2006-05-21 21:11:28 +00:00
|
|
|
}
|
|
|
|
|
2006-08-21 22:25:21 +00:00
|
|
|
int CONFIG::parse_options(XML_PARSER& xp) {
|
2007-08-16 17:33:41 +00:00
|
|
|
char tag[1024], path[256];
|
2006-08-21 22:25:21 +00:00
|
|
|
bool is_tag;
|
2007-10-20 16:10:57 +00:00
|
|
|
string s;
|
2006-08-21 22:25:21 +00:00
|
|
|
|
2006-08-23 03:34:30 +00:00
|
|
|
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
2006-08-21 22:25:21 +00:00
|
|
|
if (!is_tag) {
|
2007-01-25 23:39:06 +00:00
|
|
|
msg_printf(NULL, MSG_USER_ERROR,
|
2006-08-21 22:25:21 +00:00
|
|
|
"Unexpected text %s in %s", tag, CONFIG_FILE
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
2006-07-11 22:52:17 +00:00
|
|
|
if (!strcmp(tag, "/options")) {
|
|
|
|
return 0;
|
2006-08-21 22:25:21 +00:00
|
|
|
}
|
2007-06-08 07:55:27 +00:00
|
|
|
if (xp.parse_int(tag, "save_stats_days", save_stats_days)) continue;
|
|
|
|
if (xp.parse_bool(tag, "dont_check_file_sizes", dont_check_file_sizes)) continue;
|
|
|
|
if (xp.parse_bool(tag, "http_1_0", http_1_0)) continue;
|
|
|
|
if (xp.parse_int(tag, "ncpus", ncpus)) continue;
|
|
|
|
if (xp.parse_int(tag, "max_file_xfers", max_file_xfers)) continue;
|
|
|
|
if (xp.parse_int(tag, "max_file_xfers_per_project", max_file_xfers_per_project)) continue;
|
|
|
|
if (xp.parse_bool(tag, "suppress_net_info", suppress_net_info)) continue;
|
|
|
|
if (xp.parse_bool(tag, "disallow_attach", disallow_attach)) continue;
|
|
|
|
if (xp.parse_bool(tag, "os_random_only", os_random_only)) continue;
|
|
|
|
if (xp.parse_bool(tag, "no_alt_platform", no_alt_platform)) continue;
|
2007-07-02 20:55:21 +00:00
|
|
|
if (xp.parse_bool(tag, "simple_gui_only", simple_gui_only)) continue;
|
2007-07-09 16:00:10 +00:00
|
|
|
if (xp.parse_bool(tag, "dont_contact_ref_site", dont_contact_ref_site)) continue;
|
2007-10-20 16:10:57 +00:00
|
|
|
if (xp.parse_string(tag, "alt_platform", s)) {
|
|
|
|
alt_platforms.push_back(s);
|
2007-10-22 23:56:10 +00:00
|
|
|
continue;
|
2007-10-20 16:10:57 +00:00
|
|
|
}
|
2007-08-16 17:33:41 +00:00
|
|
|
if (xp.parse_str(tag, "data_dir", path, sizeof(path))) {
|
|
|
|
if (chdir(path)) {
|
|
|
|
perror("chdir");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2007-10-24 22:48:47 +00:00
|
|
|
if (xp.parse_int(tag, "max_stdout_file_size", max_stdout_file_size)) continue;
|
|
|
|
if (xp.parse_int(tag, "max_stderr_file_size", max_stderr_file_size)) continue;
|
2007-11-21 19:57:40 +00:00
|
|
|
if (xp.parse_bool(tag, "report_results_immediately", report_results_immediately)) continue;
|
2007-12-27 21:40:20 +00:00
|
|
|
if (xp.parse_double(tag, "start_delay", start_delay)) continue;
|
2008-01-13 00:12:14 +00:00
|
|
|
if (xp.parse_bool(tag, "run_apps_manually", run_apps_manually)) continue;
|
2008-02-07 16:05:56 +00:00
|
|
|
if (xp.parse_string(tag, "force_auth", force_auth)) {
|
|
|
|
downcase_string(force_auth);
|
|
|
|
continue;
|
|
|
|
}
|
2008-09-04 12:17:58 +00:00
|
|
|
if (xp.parse_bool(tag, "allow_multiple_clients", allow_multiple_clients)) continue;
|
|
|
|
if (xp.parse_bool(tag, "use_certs", use_certs)) continue;
|
|
|
|
if (xp.parse_bool(tag, "use_certs_only", use_certs_only)) continue;
|
2008-09-29 16:47:10 +00:00
|
|
|
if (xp.parse_string(tag, "exclusive_app", s)) {
|
|
|
|
exclusive_apps.push_back(s);
|
|
|
|
continue;
|
|
|
|
}
|
2008-10-14 23:07:40 +00:00
|
|
|
if (xp.parse_string(tag, "client_version_check_url", client_version_check_url)) {
|
|
|
|
downcase_string(client_version_check_url);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (xp.parse_string(tag, "client_download_url", client_download_url)) {
|
|
|
|
downcase_string(client_download_url);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (xp.parse_string(tag, "network_test_url", network_test_url)) {
|
|
|
|
downcase_string(network_test_url);
|
|
|
|
continue;
|
|
|
|
}
|
2008-12-16 00:09:51 +00:00
|
|
|
if (xp.parse_bool(tag, "no_gpus", no_gpus)) continue;
|
2008-01-21 14:02:22 +00:00
|
|
|
msg_printf(NULL, MSG_USER_ERROR, "Unrecognized tag in %s: <%s>\n",
|
2007-06-08 07:55:27 +00:00
|
|
|
CONFIG_FILE, tag
|
|
|
|
);
|
2007-07-03 21:55:50 +00:00
|
|
|
xp.skip_unexpected(tag, true, "CONFIG::parse_options");
|
2006-07-11 22:52:17 +00:00
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
|
|
|
|
2006-06-21 22:08:20 +00:00
|
|
|
int CONFIG::parse(FILE* f) {
|
2006-07-11 23:27:32 +00:00
|
|
|
char tag[256];
|
2006-08-22 21:52:44 +00:00
|
|
|
MIOFILE mf;
|
|
|
|
XML_PARSER xp(&mf);
|
2006-08-21 22:25:21 +00:00
|
|
|
bool is_tag;
|
|
|
|
|
2006-08-22 21:52:44 +00:00
|
|
|
mf.init_file(f);
|
2006-09-11 19:03:00 +00:00
|
|
|
if (!xp.parse_start("cc_config")) {
|
2007-01-25 23:39:06 +00:00
|
|
|
msg_printf(NULL, MSG_USER_ERROR, "Missing start tag in %s", CONFIG_FILE);
|
2006-09-11 19:03:00 +00:00
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
2006-08-23 03:34:30 +00:00
|
|
|
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
2006-08-21 22:25:21 +00:00
|
|
|
if (!is_tag) {
|
2007-01-25 23:39:06 +00:00
|
|
|
msg_printf(NULL, MSG_USER_ERROR,
|
2006-08-21 22:25:21 +00:00
|
|
|
"Unexpected text %s in %s", tag, CONFIG_FILE
|
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
2006-06-21 22:08:20 +00:00
|
|
|
if (!strcmp(tag, "/cc_config")) return 0;
|
|
|
|
if (!strcmp(tag, "log_flags")) {
|
2006-08-21 22:25:21 +00:00
|
|
|
log_flags.parse(xp);
|
2006-05-21 21:11:28 +00:00
|
|
|
continue;
|
2007-06-11 21:30:26 +00:00
|
|
|
}
|
|
|
|
if (!strcmp(tag, "options")) {
|
2006-08-21 22:25:21 +00:00
|
|
|
parse_options(xp);
|
2007-06-11 21:30:26 +00:00
|
|
|
continue;
|
2006-05-21 21:11:28 +00:00
|
|
|
}
|
2007-06-11 21:30:26 +00:00
|
|
|
msg_printf(NULL, MSG_USER_ERROR, "Unparsed tag in %s: <%s>\n",
|
|
|
|
CONFIG_FILE, tag
|
|
|
|
);
|
2007-07-03 21:55:50 +00:00
|
|
|
xp.skip_unexpected(tag, true, "CONFIG.parse");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
2007-01-25 23:39:06 +00:00
|
|
|
msg_printf(NULL, MSG_USER_ERROR, "Missing end tag in %s", CONFIG_FILE);
|
2002-04-30 22:22:54 +00:00
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
2002-08-12 23:18:47 +00:00
|
|
|
|
2008-10-10 17:23:51 +00:00
|
|
|
int read_config_file(bool init) {
|
2002-08-12 23:18:47 +00:00
|
|
|
FILE* f;
|
|
|
|
|
2007-04-26 21:57:42 +00:00
|
|
|
log_flags.defaults();
|
|
|
|
config.defaults();
|
|
|
|
|
2008-10-10 17:23:51 +00:00
|
|
|
if (!init) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "Re-reading cc_config.xml");
|
|
|
|
}
|
2006-06-21 22:08:20 +00:00
|
|
|
f = boinc_fopen(CONFIG_FILE, "r");
|
2006-12-17 02:48:19 +00:00
|
|
|
if (!f) return ERR_FOPEN;
|
2006-06-21 22:08:20 +00:00
|
|
|
config.parse(f);
|
|
|
|
fclose(f);
|
2006-12-17 02:48:19 +00:00
|
|
|
return 0;
|
2002-08-12 23:18:47 +00:00
|
|
|
}
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_5f23de6652 = "$Id$";
|