diff --git a/src/options.c b/src/options.c
index dc0475c4d1be040e61bbd896f70190dcb4ca573f..1b592a567fa39e0035144255b081a7e96371ae2b 100644 (file)
--- a/src/options.c
+++ b/src/options.c
#include "options.h"
#include "config.h"
-#include "ncmpc.h"
-#include "support.h"
+#include "defaults.h"
+#include "charset.h"
#include "command.h"
#include "conf.h"
#include <stdlib.h>
#include <string.h>
+#include <glib.h>
#define MAX_LONGOPT_LENGTH 32
static void
handle_option(int c, const char *arg)
{
- D("option callback -%c %s\n", c, arg);
switch (c) {
case '?': /* --help */
display_help();
exit(EXIT_SUCCESS);
case 'V': /* --version */
- printf("%s version: %s\n", PACKAGE, VERSION);
- printf("build options:");
+ puts(PACKAGE " version: " VERSION "\n"
+ "build options:"
#ifndef NDEBUG
- printf(" debug");
+ " debug"
#endif
#ifdef ENABLE_NLS
- printf(" nls");
+ " nls"
+#endif
+#ifdef ENABLE_COLORS
+ " colors"
+#else
+ " no-colors"
#endif
#ifdef HAVE_GETMOUSE
- printf(" getmouse");
+ " getmouse"
#endif
#ifdef ENABLE_ARTIST_SCREEN
- printf(" artist-screen");
+ " artist-screen"
#endif
#ifdef ENABLE_SEARCH_SCREEN
- printf(" search-screen");
+ " search-screen"
#endif
#ifdef ENABLE_KEYDEF_SCREEN
- printf(" key-screen");
+ " key-screen"
#endif
- printf("\n");
+ "\n");
exit(EXIT_SUCCESS);
case 'c': /* --colors */
- options.enable_colors = TRUE;
+#ifdef ENABLE_COLORS
+ options.enable_colors = true;
+#endif
break;
case 'C': /* --no-colors */
- options.enable_colors = FALSE;
+#ifdef ENABLE_COLORS
+ options.enable_colors = false;
+#endif
break;
case 'm': /* --mouse */
- options.enable_mouse = TRUE;
+ options.enable_mouse = true;
break;
case 'M': /* --no-mouse */
- options.enable_mouse = FALSE;
+ options.enable_mouse = false;
break;
case 'e': /* --exit */
- options.reconnect = FALSE;
+ options.reconnect = false;
break;
case 'p': /* --port */
options.port = atoi(arg);
exit(EXIT_SUCCESS);
break;
case 'D': /* --debug */
- options.debug = TRUE;
+ options.debug = true;
break;
#endif
default:
}
options_t *
-options_init( void )
+options_init(void)
{
const char *value;
char *tmp;
options.port = DEFAULT_PORT;
/* default option values */
- options.reconnect = TRUE;
- options.find_wrap = TRUE;
- options.wide_cursor = TRUE;
- options.welcome_screen_list = TRUE;
- options.audible_bell = TRUE;
+ options.list_format = g_strdup(DEFAULT_LIST_FORMAT);
+ options.status_format = g_strdup(DEFAULT_STATUS_FORMAT);
+ options.reconnect = true;
+ options.find_wrap = true;
+ options.wide_cursor = true;
+ options.welcome_screen_list = true;
+ options.audible_bell = true;
options.crossfade_time = DEFAULT_CROSSFADE_TIME;
options.seek_time = 1;
options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0);