diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-04-23 14:39:31 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-04-23 14:39:31 +0100 |
commit | 8f9f02d483b87c787d089cf9329f5f1b81d3a77e (patch) | |
tree | ee1c0403092e9dd296c43706a0c7c2d14d5a5c19 /ruby | |
parent | 713283f4a67b3a1960ca96ce6608d046fc202d2d (diff) | |
download | libguestfs-8f9f02d483b87c787d089cf9329f5f1b81d3a77e.tar.gz libguestfs-8f9f02d483b87c787d089cf9329f5f1b81d3a77e.tar.xz libguestfs-8f9f02d483b87c787d089cf9329f5f1b81d3a77e.zip |
Generated code for debug command.
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/ext/guestfs/_guestfs.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index 89eb6afd..07b02287 100644 --- a/ruby/ext/guestfs/_guestfs.c +++ b/ruby/ext/guestfs/_guestfs.c @@ -2318,6 +2318,39 @@ static VALUE ruby_guestfs_mount_vfs (VALUE gv, VALUE optionsv, VALUE vfstypev, V return Qnil; } +static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv) +{ + guestfs_h *g; + Data_Get_Struct (gv, guestfs_h, g); + if (!g) + rb_raise (rb_eArgError, "%s: used handle after closing it", "debug"); + + const char *subcmd = StringValueCStr (subcmdv); + if (!subcmd) + rb_raise (rb_eTypeError, "expected string for parameter %s of %s", + "subcmd", "debug"); + char **extraargs; { + int i, len; + len = RARRAY_LEN (extraargsv); + extraargs = malloc (sizeof (char *) * (len+1)); + for (i = 0; i < len; ++i) { + VALUE v = rb_ary_entry (extraargsv, i); + extraargs[i] = StringValueCStr (v); + } + } + + char *r; + + r = guestfs_debug (g, subcmd, extraargs); + free (extraargs); + if (r == NULL) + rb_raise (e_Error, "%s", guestfs_last_error (g)); + + VALUE rv = rb_str_new2 (r); + free (r); + return rv; +} + /* Initialize the module. */ void Init__guestfs () { @@ -2520,4 +2553,6 @@ void Init__guestfs () ruby_guestfs_mount_options, 3); rb_define_method (c_guestfs, "mount_vfs", ruby_guestfs_mount_vfs, 4); + rb_define_method (c_guestfs, "debug", + ruby_guestfs_debug, 2); } |