From: kremlin Date: Tue, 22 Jul 2014 00:34:02 +0000 (-0500) Subject: cut out config.c & config.h, they are unnessecary X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=196592eee1ea2c613a1358098230f87dd4b02b01;p=systembsd.git cut out config.c & config.h, they are unnessecary --- diff --git a/src/config.c b/src/config.c deleted file mode 100644 index 68ea3be..0000000 --- a/src/config.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014 Ian Sutton - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include "config.h" - -static GKeyFile *config; -static int config_descr; -static gchar *data_dir; - -/* NULL if key doesn't exist */ -gchar *get_option(gchar *key, gchar *group) { - - if(!group) - group = "default"; - - return g_key_file_get_string(config, group, key, NULL); -} - -/* false if key isn't already defined or value is invalid */ -gboolean set_option(gchar *key, gchar *value, gchar *group) { - - if(!group) - group = "default"; - - if(!g_key_file_get_string(config, group, key, NULL)) - return FALSE; - - /* TODO safteycheck value */ - g_key_file_set_string(config, group, key, value); - return TRUE; -} - -/* initial load/check */ -gboolean config_init() { - - /* config is already set */ - if(config) - return TRUE; - - config = g_key_file_new(); - - const gchar *config_path; - GStatBuf *config_lstat; - int config_lstat_ret; - - config_path = "/etc/systemd_compat.conf"; - config_lstat_ret = g_lstat(config_path, config_lstat); - - if(g_access(config_path, W_OK)) { - - g_printf("%s\n", "no write permissions for /etc/! exiting.."); - return FALSE; - - } else if(g_key_file_load_from_file(config, config_path, G_KEY_FILE_KEEP_COMMENTS, NULL)) - return TRUE; - - g_printf("could not read config at %s! exiting..", config_path); - return FALSE; -} - -void clean_config() { - - /* TODO g_ptr_array all of this */ - g_free(config); - g_free(data_dir); - g_close(config_descr, NULL); -} diff --git a/src/config.h b/src/config.h deleted file mode 100644 index 50224a9..0000000 --- a/src/config.h +++ /dev/null @@ -1,18 +0,0 @@ -/* manually increment this if adding new functionality/config files */ -static const guint XML_FILE_COUNT = 8; - -/* TODO ifdef allowed editable xml only take files that meet exact sizes - * of ones hashed below */ - -#ifndef ALLOW_EDITED_XML - -static const gchar *hostnamed_dbus_sum = "ad7536541463e426388c7562b0e7a693c3b646539b3ae163a7caf6ad95f10e08"; -static const gchar *hostnamed_ispect_sum = "4a41b3c3b0169fb7859ed5a2bde9c8c92f2b67e5e22b6e240cb6f41f6d2e69db"; -static const gchar *localed_dbus_sum = "fd3a5e13f660ca393d66e518eb5ba1b94e26ad055f7485955ba0070eec4e217c"; -static const gchar *localed_ispect_sum = "3ef138659ebfd3a8b7bb11d658ed80867493e774d69ff5c70e26b39b6fef6378"; -static const gchar *logind_dbus_sum = "f698082a6b6c42aa0d9dbd8726adfe84ef08bb84779128fefc6bb40c9476b70b"; -static const gchar *logind_ispect_sum = "557f98d71d1b4e62ecc5c7558db72f2293e42ee8ee9722ec3ffcffd9681a6bf3"; -static const gchar *timedated_dbus_sum = "d7d67482a821cbc7a6ab3a68f1c00e0dc61a98c3c317461abe8b7aba7ac7b864"; -static const gchar *timedated_ispect_sum = "f576cb908636a285c9cd2e42a71ad243a0d5eb0ff12398f0627cce56c15a8268"; - -#endif