3 * Copyright 2007,2012 Intel Corporation
5 * This program file is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * You should have received a copy of the GNU General Public License
15 * along with this program in a file named COPYING; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
21 * Arjan van de Ven <arjan@linux.intel.com>
22 * William Douglas <william.douglas@intel.com>
23 * Tim Pepper <timothy.c.pepper@linux.intel.com>
32 #include "corewatcher.h"
34 char *submit_url[MAX_URLS];
37 void read_config_file(char *filename)
40 char *line = NULL, *line_end = NULL;
43 file = fopen(filename, "r");
50 if (getline(&line, &line_len, file) == -1)
56 /* we don't care about any lines that are too short to have config options */
60 /* remove trailing\n */
61 n = strchr(line, '\n');
64 line_end = line + line_len;
66 c = strstr(line, "allow-submit");
70 if (!strstr(c, "yes")) {
71 printf("Error: allow-submit!=yes in config file.\n");
72 printf("Corewatcher will not run.\n");
78 c = strstr(line, "allow-pass-on");
82 if (!strstr(c, "yes")) {
83 printf("Error: allow-pass-on!=yes in config file.\n");
84 printf("Corewatcher will not run.\n");
90 c = strstr(line, "submit-url");
91 if (c && url_count <= MAX_URLS) {
94 c = strstr(c, "http");
96 submit_url[url_count] = strdup(c);
97 if (!submit_url[url_count])
98 submit_url[url_count] = NULL;
110 submit_url[url_count] = strdup("https://tz.otcshare.org/crashdb/crash_submit/");
111 if (!submit_url[url_count])
112 submit_url[url_count] = NULL;