exit(EXIT_FAILURE);
}
- if (!captive_init(argv[1],
- (!argv[2] ? NULL : g_io_channel_new_file( /* FIXME: g_io_channel_new_file() is NOT 64-bit compliant! */
- argv[2], /* filename */
- "r", /* mode */
- NULL)))) /* error */
- g_error(_("captive_init FAIL"));
+ if (FALSE!=captive_init(
+ argv[1], /* captive_args */
+ NULL)) /* image_iochannel */
+ g_error(_("captive_init captive_args phase FAIL"));
+
+ if (TRUE!=captive_init(NULL, /* captive_args */
+ ( /* image_iochannel */
+ !argv[2] ? NULL : g_io_channel_new_file( /* FIXME: g_io_channel_new_file() is NOT 64-bit compliant! */
+ argv[2], /* filename */
+ (captive_option_rwmode==CAPTIVE_OPTION_RWMODE_RW ? "w+" : "r"), /* mode */
+ NULL)))) /* error */
+ g_error(_("captive_init image_iochannel FAIL"));
return EXIT_SUCCESS;
}
* @captive_args: String with possible options to parse by popt.
* %NULL value is permitted.
* @image_iochannel: Host OS file of the disk image to mount.
- * %NULL value is forbidden.
+ * %NULL value is permitted (initialization would not apply in such case).
*
* Initializes %libcaptive and loads the specified filesystem.
+ * You can supply %NULL value for @image_iochannel - in such case no library
+ * initialization is done; only passed @captive_args are parsed. Function
+ * will return you %FALSE value as it is not yet initializied.
*
- * You should supply
+ * You should supply only @captive_args with %NULL @image_iochannel if you
+ * need to parse+examine the arguments to properly initialize @image_iochannel.
*
- * Returns: %TRUE if successfuly loaded.
+ * Returns: %TRUE if successfuly initialized.
*/
gboolean captive_init(const gchar *captive_args,GIOChannel *image_iochannel)
{
}
}
+ /* If we were just requested to parse the arguments. */
+ if (!image_iochannel)
+ return FALSE;
+
g_return_val_if_fail(image_iochannel!=NULL,FALSE);
captive_image_iochannel=image_iochannel;