#include <stdio.h>
#include <locale.h>
-#include <captive/client.h> /* for captive_init() */
+#include <captive/client-vfs.h>
#include "main.h" /* self */
#include "cmd_shell.h"
#include "cmd_help.h"
+CaptiveVfsObject *cmdline_captive_vfs_object;
+
+
GQuark cmdline_main_error_quark(void)
{
GQuark r=0;
int cmd_argc;
GError *gerr=NULL;
const char *cmd_cd_root_args[]={"/",NULL};
+struct captive_options options;
/* Initialize the i18n stuff */
setlocale(LC_ALL,"");
bindtextdomain(PACKAGE,LOCALEDIR);
textdomain(PACKAGE);
+ /* Initialize GObject subsystem of GLib. */
+ g_type_init();
+
+ captive_options_init(&options);
+ captive_options=&options; /* for parsing by 'CAPTIVE_POPT_INCLUDE' */
+
context=poptGetContext(
PACKAGE, /* name */
argc,(/*en-const*/const char **)argv, /* argc,argv */
for (csp=cmd_argv,cmd_argc=0;csp && *csp;csp++)
cmd_argc++;
- if (TRUE!=captive_init(NULL, /* captive_args; already parsed above */
- ( /* image_iochannel */
- !cmd_argc ? NULL : g_io_channel_new_file( /* FIXME: g_io_channel_new_file() is NOT 64-bit compliant! */
- cmd_argv[0], /* filename */
- (captive_option_rwmode==CAPTIVE_OPTION_RWMODE_RW ? "r+" : "r"), /* mode */
- NULL)))) /* error */
- g_error(_("captive_init image_iochannel FAIL"));
+ captive_options=NULL; /* already parsed by 'CAPTIVE_POPT_INCLUDE' */
+
+ /* image_iochannel */
+ if (cmd_argc) {
+ g_assert(options.image_iochannel==NULL);
+ if (!(options.image_iochannel=g_io_channel_new_file(
+ cmd_argv[0], /* filename */
+ (options.rwmode==CAPTIVE_OPTION_RWMODE_RW ? "r+" : "r"), /* mode */
+ NULL))) { /* error */
+ g_error(_("image_iochannel open failed"));
+ return EXIT_FAILURE;
+ }
+ }
if (cmd_argc>0) {
/* image file */
cmd_argc--;
cmd_argv++;
}
+ if (GNOME_VFS_OK!=captive_vfs_new(&cmdline_captive_vfs_object,&options)) {
+ g_error(_("captive_vfs_new() failed"));
+ return EXIT_FAILURE;
+ }
+ captive_options_free(&options);
+
cmd_cd(cmd_cd_root_args,&gerr);
if (gerr) {
err_cleanup(&gerr);