Remove the selectedwindow options.

There is no logic behind the default window selection. The last
option parsed set the default window. Instead of having a specific
boolean set, use the first bit found in the flags for selecting the
the windows.

eg. powerdebug -s -g
	=> flags = SENSOR_OPTION | GPIO_OPTION;
	=> flags = 0x2 | 0x8 = 0x0a
	=> flags = b01010000
	=> fsl(flags) = 2
	=> default window = 1 << fsl(flags) - 1
	=> default window = 1 << 2 - 1
	=> default window = 1 << 1
	=> default window = 2 = SENSOR_OPTION

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
diff --git a/display.c b/display.c
index ed010b3..eada839 100644
--- a/display.c
+++ b/display.c
@@ -21,6 +21,9 @@
 
 #include <stdio.h>
 #include <string.h>
+#define _GNU_SOURCE
+#include <strings.h>
+#undef _GNU_SOURCE
 #include <stdlib.h>
 #include <ctype.h>
 #include <ncurses.h>
@@ -548,12 +551,12 @@
 	return 0;
 }
 
-int display_init(int wdefault)
+int display_init(struct powerdebug_options *options)
 {
 	int i, maxx, maxy;
 	size_t array_size = sizeof(windata) / sizeof(windata[0]);
 
-	current_win = wdefault;
+	current_win = 1 << (ffs(options->flags & DEFAULT_OPTION) - 1);
 
 	if (mainloop_add(0, display_keystroke, NULL))
 		return -1;
@@ -605,13 +608,13 @@
 	if (!footer_win)
 		return -1;
 
-	if (display_show_header(wdefault))
+	if (display_show_header(current_win))
 		return -1;
 
-	if (display_show_footer(wdefault, NULL))
+	if (display_show_footer(current_win, NULL))
 		return -1;
 
-	return display_refresh(wdefault, true);
+	return display_refresh(current_win, true);
 }
 
 int display_column_name(const char *line)