#include <glib.h>
#include <stdio.h>
#include <stdlib.h>


int main(int argc, char *argv[]) {
	static gboolean feature1 = TRUE;
	static gboolean feature2 = FALSE;
	static GOptionEntry entries[] = {
		{ "enable-feature1", 0, 0, G_OPTION_ARG_NONE, &feature1, "Enable feature1", NULL },
		{ "disable-feature1", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &feature1, "Disable feature1", NULL },
		{ "enable-feature2", 0, 0, G_OPTION_ARG_NONE, &feature2, "Enable feature2", NULL },
		{ "disable-feature2", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &feature2, "Disable feature2", NULL },
  		{ NULL }
	};
	GOptionContext *context;
	GError *error = NULL;

	context = g_option_context_new ("option parser bug demonstration");
	g_option_context_add_main_entries (context, entries, NULL);
	if (!g_option_context_parse (context, &argc, &argv, &error)) {
		printf("option parsing failed: %s\n", error->message);
		exit (1);
	}

	printf("feature1: %d\n", feature1);	
	printf("feature2: %d\n", feature2);	

	return 0;
}
