gchar *captive_option_filesystem;
enum captive_option_rwmode captive_option_rwmode=CAPTIVE_OPTION_RWMODE_BLIND;
enum captive_option_media captive_option_media=CAPTIVE_OPTION_MEDIA_DISK;
+gboolean captive_debug_messages=FALSE;
GIOChannel *captive_image_iochannel;
/* Non-blinded original GIOChannel for flushing during shutdown. */
static GIOChannel *captive_image_iochannel_orig;
captive_option_media=CAPTIVE_OPTION_MEDIA_DISK;
}
+static void arg_debug_messages(void)
+{
+ captive_debug_messages=TRUE;
+}
+
static void captive_popt_callback
(poptContext con,enum poptCallbackReason reason,const struct poptOption *opt,const char *arg,const void *data);
#define CAPTIVE_POPT_NONE(longname,descripP) \
CAPTIVE_POPT(longname,POPT_ARG_NONE ,NULL ,descripP,NULL )
- CAPTIVE_POPT_STRING("filesystem" ,N_("Path to .sys or .so filesystem module file"),N_("pathname")),
- CAPTIVE_POPT_STRING("load-module",N_("Path to any W32 module to load w/o initialization"),N_("pathname")),
- CAPTIVE_POPT_NONE( "ro" ,N_("Read/write mode: Any write access will be forbidden")),
- CAPTIVE_POPT_NONE( "blind" ,N_("Read/write mode: All writes are just simulated in memory (default)")),
- CAPTIVE_POPT_NONE( "rw" ,N_("Read/write mode: Write directly to the image file/device")),
- CAPTIVE_POPT_NONE( "cdrom" ,N_("Media type: CD-ROM")),
- CAPTIVE_POPT_NONE( "disk" ,N_("Media type: Disk (default)")),
+ CAPTIVE_POPT_STRING("filesystem" ,N_("Path to .sys or .so filesystem module file"),N_("pathname")),
+ CAPTIVE_POPT_STRING("load-module" ,N_("Path to any W32 module to load w/o initialization"),N_("pathname")),
+ CAPTIVE_POPT_NONE( "ro" ,N_("Read/write mode: Any write access will be forbidden")),
+ CAPTIVE_POPT_NONE( "blind" ,N_("Read/write mode: All writes are just simulated in memory (default)")),
+ CAPTIVE_POPT_NONE( "rw" ,N_("Read/write mode: Write directly to the image file/device")),
+ CAPTIVE_POPT_NONE( "cdrom" ,N_("Media type: CD-ROM")),
+ CAPTIVE_POPT_NONE( "disk" ,N_("Media type: Disk (default)")),
+ CAPTIVE_POPT_NONE( "debug-messages",N_("Turn on debugging messages")),
#undef CAPTIVE_POPT_NONE
#undef CAPTIVE_POPT_STRING
arg_rw,
arg_cdrom,
arg_disk,
+ arg_debug_messages,
};
static void captive_shutdown_atexit(void);
+static void log_discard_func(const gchar *log_domain,GLogLevelFlags log_level,const gchar *message,gpointer user_data)
+{
+ /* NOP */
+}
+
+
/**
* captive_init:
* @captive_args: String with possible options to parse by popt.
if (!image_iochannel)
return FALSE;
- g_return_val_if_fail(image_iochannel!=NULL,FALSE);
+ if (!captive_debug_messages) {
+ g_log_set_handler(
+ G_LOG_DOMAIN, /* log_domain; "Captive" */
+ 0 /* log_levels */
+ | G_LOG_FLAG_RECURSION
+ | G_LOG_FLAG_FATAL
+ | G_LOG_LEVEL_MESSAGE
+ | G_LOG_LEVEL_INFO
+ | G_LOG_LEVEL_DEBUG,
+ log_discard_func, /* log_func */
+ NULL); /* user_data */
+ }
if (captive_option_rwmode==CAPTIVE_OPTION_RWMODE_BLIND)
captive_image_iochannel=(GIOChannel *)captive_giochannel_blind_new(image_iochannel);