From: Lennart Poettering Date: Fri, 13 Apr 2007 09:43:19 +0000 (+0000) Subject: check both !isatty() and $DISPLAY before assuming we ar running from an X11 session X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=e29f1a1c940e76f1be19ed2c448c7c6257a5cbfe;p=catta check both !isatty() and $DISPLAY before assuming we ar running from an X11 session git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1423 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-ui/zssh.c b/avahi-ui/zssh.c index a38a9d9..245fa4d 100644 --- a/avahi-ui/zssh.c +++ b/avahi-ui/zssh.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -66,6 +67,8 @@ int main(int argc, char*argv[]) { h = g_strdup(aui_service_dialog_get_host_name(AUI_SERVICE_DIALOG(d))); else h = g_strdup(avahi_address_snprint(a, sizeof(a), aui_service_dialog_get_address(AUI_SERVICE_DIALOG(d)))); + + g_print("Connecting to '%s' ...\n", n); if (avahi_domain_equal(t, "_rfb._tcp")) { char p[AVAHI_DOMAIN_NAME_MAX+16]; @@ -99,7 +102,7 @@ int main(int argc, char*argv[]) { if (u) { g_print("ssh -p %s -l %s %s\n", p, u, h); - if (isatty(0)) + if (isatty(0) || !getenv("DISPLAY")) execlp("ssh", "ssh", "-p", p, "-l", u, h, NULL); else { execlp("x-terminal-emulator", "x-terminal-emulator", "-T", n, "-e", "ssh", "-p", p, "-l", u, h, NULL); @@ -109,7 +112,7 @@ int main(int argc, char*argv[]) { } else { g_print("ssh -p %s %s\n", p, h); - if (isatty(0)) + if (isatty(0) || !getenv("DISPLAY")) execlp("ssh", "ssh", "-p", p, h, NULL); else { execlp("x-terminal-emulator", "x-terminal-emulator", "-T", n, "-e", "ssh", "-p", p, h, NULL); @@ -119,7 +122,7 @@ int main(int argc, char*argv[]) { } } - g_warning("execlp() failed: %s", strerror(errno)); + g_warning("execlp() failed: %s\n", strerror(errno)); g_free(h); g_free(u);