diff options
author | Bertrand Jacquin (Beber) <beber.mailing@gmail.com> | 2006-04-30 03:01:03 +0200 |
---|---|---|
committer | beber <beber@meathook.melee> | 2006-04-30 03:01:03 +0200 |
commit | 20e7c8f2225cb5861317a7aef8998362fdd35b25 (patch) | |
tree | d026bd0cd0cd6d97bd19084213c7ce5c29628310 /src/espik_config.c | |
parent | oops, forgot to change get_version in m4 macros (diff) | |
download | espik-20e7c8f2225cb5861317a7aef8998362fdd35b25.tar.xz |
indent fixe
Diffstat (limited to '')
-rw-r--r-- | src/espik_config.c | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/src/espik_config.c b/src/espik_config.c index a840e67..2ce70ba 100644 --- a/src/espik_config.c +++ b/src/espik_config.c @@ -11,133 +11,133 @@ #include "espik_error.h" #include "espik_config.h" -t_servinfo* espik_server_config_set (char* server, unsigned short port) +t_servinfo* espik_server_config_set (char* server, unsigned short port) { - t_servinfo* s_info; + t_servinfo* s_info; - s_info = malloc (sizeof (t_servinfo)); + s_info = malloc (sizeof (t_servinfo)); - s_info->host = strdup (server); - s_info->port = port; + s_info->host = strdup (server); + s_info->port = port; - espik_free (server); - return (s_info); + espik_free (server); + return (s_info); } -t_userinfo* espik_user_sysinfo_get (void) +t_userinfo* espik_user_sysinfo_get (void) { - struct passwd* pw; - t_userinfo* u_info; + struct passwd* pw; + t_userinfo* u_info; - pw = getpwuid (getuid ()); + pw = getpwuid (getuid ()); - u_info = malloc (sizeof (t_userinfo)); + u_info = malloc (sizeof (t_userinfo)); - //u_info->nickname = pw->pw_name; - u_info->nickname = strdup ("beber_espik_test"); - u_info->username = strdup (pw->pw_name); - - if (! (pw->pw_gecos[0]) ) - u_info->realname = strdup ("espik user"); - else - u_info->realname = strdup (pw->pw_gecos); + //u_info->nickname = pw->pw_name; + u_info->nickname = strdup ("beber_espik_test"); + u_info->username = strdup (pw->pw_name); + + if (! (pw->pw_gecos[0]) ) + u_info->realname = strdup ("espik user"); + else + u_info->realname = strdup (pw->pw_gecos); - espik_free (u_info); - espik_free (pw); + espik_free (u_info); + espik_free (pw); - return (u_info); + return (u_info); } -void espik_config_default_set (void) +void espik_config_default_set (void) { - t_userinfo* user_sysinfo; + t_userinfo* user_sysinfo; - ecore_config_string_default ("/config/server/0/host", "beber.melee"); - ecore_config_int_default ("/config/server/0/port", 6667); + ecore_config_string_default ("/config/server/0/host", "beber.melee"); + ecore_config_int_default ("/config/server/0/port", 6667); - user_sysinfo = espik_user_sysinfo_get (); + user_sysinfo = espik_user_sysinfo_get (); - ecore_config_string_default ("/config/user/nickname", - user_sysinfo->nickname); - ecore_config_string_default ("/config/user/username", - user_sysinfo->username); - ecore_config_string_default ("/config/user/realname", - user_sysinfo->realname); + ecore_config_string_default ("/config/user/nickname", + user_sysinfo->nickname); + ecore_config_string_default ("/config/user/username", + user_sysinfo->username); + ecore_config_string_default ("/config/user/realname", + user_sysinfo->realname); - ecore_config_string_default ("/espik/version", ESPIK_VERSION); + ecore_config_string_default ("/espik/version", ESPIK_VERSION); - espik_free (user_sysinfo->nickname); - espik_free (user_sysinfo->username); - espik_free (user_sysinfo->realname); - espik_free (user_sysinfo); + espik_free (user_sysinfo->nickname); + espik_free (user_sysinfo->username); + espik_free (user_sysinfo->realname); + espik_free (user_sysinfo); } -void espik_config_init (void) +void espik_config_init (void) { - if (ecore_config_init (APPS_NAME) != ECORE_CONFIG_ERR_SUCC) - printf ("Init ecore_config failed\n"); - - if (ecore_config_load () != ECORE_CONFIG_ERR_SUCC) - { - /* If an config option is not present, - * this will force it to a value */ - printf ("Load ecore_config failed\n"); - espik_config_default_set (); - } + if (ecore_config_init (APPS_NAME) != ECORE_CONFIG_ERR_SUCC) + printf ("Init ecore_config failed\n"); + + if (ecore_config_load () != ECORE_CONFIG_ERR_SUCC) + { + /* If an config option is not present, + * this will force it to a value */ + printf ("Load ecore_config failed\n"); + espik_config_default_set (); + } } void espik_config_shutdown (t_info s_info) { - espik_free (s_info.server); - espik_free (s_info.client); + espik_free (s_info.server); + espik_free (s_info.client); /* free (s_info); */ - ecore_config_save(); - ecore_config_shutdown(); + ecore_config_save(); + ecore_config_shutdown(); } -void espik_config_get (t_info *s_info) +void espik_config_get (t_info *s_info) { - s_info->server = malloc (sizeof (t_servinfo)); - s_info->client = malloc (sizeof (t_userinfo)); - - s_info->server->host = - ecore_config_string_get ("/config/server/0/host"); - s_info->server->port = - (unsigned short)ecore_config_int_get ("/config/server/0/port"); - - s_info->client->nickname = - ecore_config_string_get ("/config/user/nickname"); - s_info->client->username = - ecore_config_string_get ("/config/user/username"); - s_info->client->realname = - ecore_config_string_get ("/config/user/realname"); - - if (ecore_config_save () != ECORE_CONFIG_ERR_SUCC) - { - printf ("Save ecore_config failed"); - exit (-1); - } + s_info->server = malloc (sizeof (t_servinfo)); + s_info->client = malloc (sizeof (t_userinfo)); + + s_info->server->host = + ecore_config_string_get ("/config/server/0/host"); + s_info->server->port = + (unsigned short)ecore_config_int_get ("/config/server/0/port"); + + s_info->client->nickname = + ecore_config_string_get ("/config/user/nickname"); + s_info->client->username = + ecore_config_string_get ("/config/user/username"); + s_info->client->realname = + ecore_config_string_get ("/config/user/realname"); + + if (ecore_config_save () != ECORE_CONFIG_ERR_SUCC) + { + printf ("Save ecore_config failed"); + exit (-1); + } } -void espik_config_set (t_info config) +void espik_config_set (t_info config) { - 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", - (int)config.server->port); - ecore_config_int_set ("/config/server/0/autoconnect", 1); - - ecore_config_string_set ("/config/user/nickname", - config.client->nickname); - ecore_config_string_set ("/config/user/username", - config.client->username); - ecore_config_string_set ("/config/user/realname", - config.client->realname); - - if (ecore_config_save () != ECORE_CONFIG_ERR_SUCC) - { - printf ("Save ecore_config failed"); - exit (-1); - } + 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", + (int)config.server->port); + ecore_config_int_set ("/config/server/0/autoconnect", 1); + + ecore_config_string_set ("/config/user/nickname", + config.client->nickname); + ecore_config_string_set ("/config/user/username", + config.client->username); + ecore_config_string_set ("/config/user/realname", + config.client->realname); + + if (ecore_config_save () != ECORE_CONFIG_ERR_SUCC) + { + printf ("Save ecore_config failed"); + exit (-1); + } } |