win32 fixes

This commit is contained in:
jsorg71 2005-11-19 01:37:49 +00:00
parent c401d58c74
commit 7c69e43493
2 changed files with 31 additions and 25 deletions

View File

@ -21,9 +21,9 @@
#if !defined(FILE_H)
#define FILE_H
int
int APP_CC
file_read_sections(int fd, struct list* names);
int
int APP_CC
file_read_section(int fd, char* section, struct list* names,
struct list* values);

View File

@ -19,13 +19,15 @@
session manager - read config file
*/
#include "arch.h"
#include "list.h"
#include "file.h"
#include "sesman.h"
/******************************************************************************/
static int text2bool(char* s)
{
static int APP_CC
text2bool(char* s)
{
if (0 == g_strncasecmp(s, "1", 1) ||
0 == g_strncasecmp(s, "true", 4) ||
0 == g_strncasecmp(s, "yes", 3))
@ -48,7 +50,7 @@ config_read(struct config_sesman* cfg)
fd = g_file_open(SESMAN_CFG_FILE);
if (-1 == fd)
{
g_printf("sesman: error reading config: %s\n\r", SESMAN_CFG_FILE);
g_printf("sesman: error reading config: %s\r\n", SESMAN_CFG_FILE);
return 1;
}
g_memset(cfg, 0, sizeof(struct config_sesman));
@ -62,10 +64,10 @@ config_read(struct config_sesman* cfg)
/* read global config */
config_read_globals(fd, cfg, param_n, param_v);
/* read logging config */
config_read_logging(fd, &(cfg->log), param_n, param_v);
/* cleanup */
list_delete(sec);
list_delete(param_v);
@ -73,15 +75,17 @@ config_read(struct config_sesman* cfg)
return 0;
}
/******************************************************************************/
int DEFAULT_CC
config_read_globals(int file, struct config_sesman* cf, struct list* param_n, struct list* param_v)
config_read_globals(int file, struct config_sesman* cf, struct list* param_n,
struct list* param_v)
{
int i;
char* buf;
list_clear(param_v);
list_clear(param_n);
file_read_section(file, SESMAN_CFG_GLOBALS, param_n, param_v);
for (i = 0; i < param_n->count; i++)
{
@ -103,18 +107,20 @@ config_read_globals(int file, struct config_sesman* cf, struct list* param_n, st
g_strncpy(cf->listen_port, (char*)list_get_item(param_v, i), 15);
}
}
g_printf("sesman config:\n\r");
g_printf("\tListenPort: %s\n\r", cf->listen_port);
g_printf("\tEnableUserWindowManager: %i\n\r", cf->enable_user_wm);
g_printf("\tUserWindowManager: %s\n\r", cf->user_wm);
g_printf("\tDefaultWindowManager: %s\n\r", cf->default_wm);
g_printf("sesman config:\r\n");
g_printf("\tListenPort: %s\r\n", cf->listen_port);
g_printf("\tEnableUserWindowManager: %i\r\n", cf->enable_user_wm);
g_printf("\tUserWindowManager: %s\r\n", cf->user_wm);
g_printf("\tDefaultWindowManager: %s\r\n", cf->default_wm);
return 0;
}
/******************************************************************************/
int DEFAULT_CC
config_read_logging(int file, struct log_config* lc, struct list* param_n, struct list* param_v)
config_read_logging(int file, struct log_config* lc, struct list* param_n,
struct list* param_v)
{
int i;
char* buf;
@ -129,7 +135,7 @@ config_read_logging(int file, struct log_config* lc, struct list* param_n, struc
lc->log_level = LOG_LEVEL_DEBUG;
lc->enable_syslog = 0;
lc->syslog_level = LOG_LEVEL_DEBUG;
file_read_section(file, SESMAN_CFG_LOGGING, param_n, param_v);
for (i = 0; i < param_n->count; i++)
{
@ -151,13 +157,13 @@ config_read_logging(int file, struct log_config* lc, struct list* param_n, struc
lc->syslog_level = log_text2level((char*)list_get_item(param_v, i));
}
}
g_printf("logging configuration:\n\r");
g_printf("\tLogFile: %s\n\r",lc->log_file);
g_printf("\tLogLevel: %i\n\r", lc->log_level);
g_printf("\tEnableSyslog: %i\n\r", lc->enable_syslog);
g_printf("\tSyslogLevel: %i\n\r", lc->syslog_level);
g_printf("logging configuration:\r\n");
g_printf("\tLogFile: %s\r\n",lc->log_file);
g_printf("\tLogLevel: %i\r\n", lc->log_level);
g_printf("\tEnableSyslog: %i\r\n", lc->enable_syslog);
g_printf("\tSyslogLevel: %i\r\n", lc->syslog_level);
return 0;
}