/*
 * call-seq:
 *  xc.connect([path]) -> self
 *
 * Connects _xc_ to the XMMS2 daemon listening at _path_.
 * If _path_ isn't given, the default path is used.
 */
static VALUE
c_connect (int argc, VALUE *argv, VALUE self)
{
        VALUE path;
        RbXmmsClient *xmms = NULL;
        char *p = NULL;

        Data_Get_Struct (self, RbXmmsClient, xmms);

        CHECK_DELETED (xmms);

        rb_scan_args (argc, argv, "01", &path);

        if (!NIL_P (path))
                p = StringValuePtr (path);

        if (!xmmsc_connect (xmms->real, p))
                rb_raise (eClientError,
                          "cannot connect to daemon (%s)",
                          xmmsc_get_last_error (xmms->real));

        return self;
}