aboutsummaryrefslogtreecommitdiff
path: root/src/espik_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/espik_config.c')
-rw-r--r--src/espik_config.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/espik_config.c b/src/espik_config.c
index 410fcf0..bbae1b8 100644
--- a/src/espik_config.c
+++ b/src/espik_config.c
@@ -8,16 +8,14 @@
#include <Ecore_Config.h>
-#include "espik_config.h"
#include "espik_error.h"
-#include "espik_debug.h"
+#include "espik_config.h"
static int ret; /* For debug */
t_servinfo* espik_server_config_set (char* server, unsigned short port)
{
t_servinfo* s_info;
- espik_enter();
s_info = malloc (sizeof (t_servinfo));
@@ -25,7 +23,6 @@ t_servinfo* espik_server_config_set (char* server, unsigned short port)
s_info->port = port;
espik_free (server);
- espik_leave();
return (s_info);
}
@@ -33,7 +30,6 @@ t_userinfo* espik_user_sysinfo_get (void)
{
struct passwd* pw;
t_userinfo* u_info;
- espik_enter();
pw = getpwuid (getuid ());
@@ -51,14 +47,12 @@ t_userinfo* espik_user_sysinfo_get (void)
espik_free (u_info);
espik_free (pw);
- espik_leave();
return (u_info);
}
void espik_config_default_set (void)
{
t_userinfo* user_sysinfo;
- espik_enter();
ecore_config_string_default ("/config/server/0/host", "beber.melee");
ecore_config_int_default ("/config/server/0/port", 6667);
@@ -78,16 +72,13 @@ void espik_config_default_set (void)
espik_free (user_sysinfo->username);
espik_free (user_sysinfo->realname);
espik_free (user_sysinfo);
- espik_leave();
}
void espik_config_init (void)
{
- espik_enter();
-
if ((ret = ecore_config_init (APPS_NAME)) != ECORE_CONFIG_ERR_SUCC)
{
- espik_debug_print ("Init ecore_config failed (%d)", ret);
+ printf ("Init ecore_config failed (%d)", ret);
//kill_me (2);
//exit (ret);
}
@@ -96,14 +87,13 @@ void espik_config_init (void)
{
/* If an config option is not present,
* this will force it to a value */
- espik_debug_print ("Load ecore_config failed (%d)", ret);
+ printf ("Load ecore_config failed (%d)", ret);
espik_config_default_set ();
/*
kill_me (2);
exit (ret);
*/
}
- espik_leave();
}
void espik_config_shutdown (t_info s_info)
@@ -118,8 +108,6 @@ void espik_config_shutdown (t_info s_info)
void espik_config_get (t_info *s_info)
{
- espik_enter();
-
s_info->server = malloc (sizeof (t_servinfo));
s_info->client = malloc (sizeof (t_userinfo));
@@ -137,16 +125,13 @@ void espik_config_get (t_info *s_info)
if (ecore_config_save () != ECORE_CONFIG_ERR_SUCC)
{
- espik_debug_print ("Save ecore_config failed");
+ printf ("Save ecore_config failed");
exit (-1);
}
- espik_leave();
}
void espik_config_set (t_info config)
{
- espik_enter();
-
ecore_config_int_set ("/config/server/len", 1);
ecore_config_string_set ("/config/server/0/host", config.server->host);
ecore_config_int_set ("/config/server/0/port",
@@ -162,8 +147,7 @@ void espik_config_set (t_info config)
if (ecore_config_save () != ECORE_CONFIG_ERR_SUCC)
{
- espik_debug_print ("Save ecore_config failed");
+ printf ("Save ecore_config failed");
exit (-1);
}
- espik_leave();
}