[X2Go-Commits] [libx2goclient] 04/04: src/test/sshtest.c: try to call connect () method of an X2GoClientNetworkSSH object, but fail so far.

git-admin at x2go.org git-admin at x2go.org
Sat Aug 3 13:19:22 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository libx2goclient.

commit 399228d65287e4b56b13ef414f09b06ef2d94876
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Aug 3 13:16:13 2019 +0200

    src/test/sshtest.c: try to call connect () method of an X2GoClientNetworkSSH object, but fail so far.
    
    There just seems to be no way to do this correctly.
    
    We'll always get a compiler warning because of mismatching pointers -
    either when assigning a function pointer to the parent class's
    connect () method or when calling x2goclient_network_ssh_connect ().
    
    So far I have no idea how you're supposed to do something like this with
    glib/GObject. There's also no code in glib itself that would use such a
    feature.
---
 src/test/sshtest.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/test/sshtest.c b/src/test/sshtest.c
index 7c676b5..e429fc2 100644
--- a/src/test/sshtest.c
+++ b/src/test/sshtest.c
@@ -28,6 +28,7 @@
 #include <libintl.h>
 
 #include <glib.h>
+#include <glib/gprintf.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 
@@ -41,19 +42,28 @@
 #define _(String) gettext (String)
 
 int main (int argc, char **argv) {
+  int ret = EXIT_FAILURE;
+
   setlocale (LC_MESSAGES, "");
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  printf (_("SSH testing utility for %s version %s\n\n"), _(PACKAGE_NAME), _(PACKAGE_VERSION));
+  g_printf (_("SSH testing utility for %s version %s\n\n"), _(PACKAGE_NAME), _(PACKAGE_VERSION));
 
   GString *ssh_uri = NULL;
   if (argc != 1) {
-    fprintf (stderr, _("Error. Program needs exactly one argument: an SSH location specifier.\n"));
+    g_fprintf (stderr, _("Error. Program needs exactly one argument: an SSH location specifier.\n"));
   }
   else {
     ssh_uri = g_string_new (argv[1]);
   }
 
-  return (EXIT_SUCCESS);
+  X2GoClientNetworkSSH *net_ssh = x2goclient_network_ssh_new ();
+  g_object_set (G_OBJECT (net_ssh), "socket", ssh_uri, NULL);
+
+  g_printf ("Trying to connect...\n");
+  gboolean conn_ret = x2goclient_network_ssh_connect (net_ssh);
+  g_printf ("Connection status: %s.\n", (conn_ret) ? "true" : "false");
+
+  return (ret);
 }

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git


More information about the x2go-commits mailing list