index 1ea1fd971e44dac34c92f28d3f0916d339c623c0..6def7b638388863bed664b181a87227706ad3c2a 100644 (file)
--- a/conf.c
+++ b/conf.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+
+#include <glib.h>
#include <ncurses.h>
#include "config.h"
/* configuration field names */
#define CONF_ENABLE_COLORS "enable_colors"
+#define CONF_AUTO_CENTER "auto_center"
+
+/* configuration field names - colors */
#define CONF_COLOR_BACKGROUND "background_color"
#define CONF_COLOR_TITLE "title_color"
#define CONF_COLOR_LINE "line_color"
#define CONF_COLOR_ALERT "alert_color"
-#define IS_WHITESPACE(c) (c==' ' || c=='\t' || c=='\r' || c=='\n')
-
-
static int
str2bool(char *str)
{
return COLOR_CYAN;
else if( !strcasecmp(str,"white") )
return COLOR_WHITE;
-#if 0
- else if( !strcasecmp(str,"grey") )
- return COLOR_BLACK | A_BOLD;
- else if( !strcasecmp(str,"brightred") )
- return COLOR_RED | A_BOLD;
- else if( !strcasecmp(str,"brightgreen") )
- return COLOR_GREEN | A_BOLD;
- else if( !strcasecmp(str,"brightyellow") )
- return COLOR_YELLOW | A_BOLD;
- else if( !strcasecmp(str,"brightblue") )
- return COLOR_BLUE | A_BOLD;
- else if( !strcasecmp(str,"brightmagenta") )
- return COLOR_MAGENTA | A_BOLD;
- else if( !strcasecmp(str,"brightcyan") )
- return COLOR_CYAN | A_BOLD;
- else if( !strcasecmp(str,"brightwhite") )
- return COLOR_WHITE | A_BOLD;
-#endif
fprintf(stderr,"Warning: unknown color %s\n", str);
return -1;
}
if( filename==NULL )
{
- filename = concat_path(getenv("HOME"), RCFILE);
+ filename = g_build_filename(g_get_home_dir(), RCFILE, NULL);
free_filename = 1;
}
{
D(perror(filename));
if( free_filename )
- free(filename);
+ g_free(filename);
return -1;
}
options->enable_colors = str2bool(value);
match_found = 1;
}
+ /* auto center */
+ else if( !strcasecmp(CONF_AUTO_CENTER, name) )
+ {
+ options->auto_center = str2bool(value);
+ match_found = 1;
+ }
/* background color */
else if( !strcasecmp(CONF_COLOR_BACKGROUND, name) )
{
D(printf( "--\n\n" ));
if( free_filename )
- free(filename);
+ g_free(filename);
return 0;
}