3 * Copyright 2007, Intel Corporation
5 * This file is part of corewatcher.org
7 * This program file is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * You should have received a copy of the GNU General Public License
17 * along with this program in a file named COPYING; if not, write to the
18 * Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301 USA
23 * Arjan van de Ven <arjan@linux.intel.com>
24 * William Douglas <william.douglas@intel.com>
33 #include "corewatcher.h"
35 char *submit_url[MAX_URLS];
36 char *build_release = NULL;
37 char *core_folder = NULL;
41 void read_config_file(char *filename)
44 char *line = NULL, *line_len = NULL;
47 file = fopen(filename, "r");
54 if (getline(&line, &dummy, file) == -1)
60 /* we don't care about any lines that are too short to have config options */
64 /* remove trailing\n */
65 n = strchr(line, '\n');
68 line_len = line + dummy;
69 c = strstr(line, "unlink");
74 c = strstr(line, "submit-url");
75 if (c && url_count <= MAX_URLS) {
78 c = strstr(c, "http:");
80 submit_url[url_count] = strdup(c);
81 if (!submit_url[url_count])
82 submit_url[url_count] = NULL;
88 c = strstr(line, "release-info");
94 build_release = strdup(c);
97 c = strstr(line, "core-folder");
103 core_folder = strdup(c);
112 build_release = strdup("/etc/meego-release");
114 submit_url[url_count] = strdup("http://crashdb.meego.com/submitbug.php");
115 if (!submit_url[url_count])
116 submit_url[url_count] = NULL;
121 core_folder = strdup("/tmp/corewatcher/");