From 300f7ba9449afc23c2b0e23f7b4dba995452b44e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 8 May 2007 21:57:32 +0000 Subject: rename "zssh" to "bssh" and "zvnc" to "bvnc" to avoid a name collision with an already existing tool of the same name. (on request of the Debian people) git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1457 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-ui/Makefile.am | 20 +++---- avahi-ui/bssh.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++ avahi-ui/bssh.desktop.in | 12 ++++ avahi-ui/bvnc.desktop.in | 12 ++++ avahi-ui/zssh.c | 140 ----------------------------------------------- avahi-ui/zssh.desktop.in | 12 ---- avahi-ui/zvnc.desktop.in | 12 ---- 7 files changed, 174 insertions(+), 174 deletions(-) create mode 100644 avahi-ui/bssh.c create mode 100644 avahi-ui/bssh.desktop.in create mode 100644 avahi-ui/bvnc.desktop.in delete mode 100644 avahi-ui/zssh.c delete mode 100644 avahi-ui/zssh.desktop.in delete mode 100644 avahi-ui/zvnc.desktop.in diff --git a/avahi-ui/Makefile.am b/avahi-ui/Makefile.am index da5eb01..c5ef64d 100644 --- a/avahi-ui/Makefile.am +++ b/avahi-ui/Makefile.am @@ -25,7 +25,7 @@ AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")' desktopdir = $(datadir)/applications desktop_DATA = -EXTRA_DIST = zssh.desktop.in zvnc.desktop.in +EXTRA_DIST = bssh.desktop.in bvnc.desktop.in if HAVE_GTK @@ -56,22 +56,22 @@ libavahi_ui_la_SOURCES += ../avahi-utils/stdb.h ../avahi-utils/stdb.c libavahi_ui_la_CFLAGS += -DDATABASE_FILE=\"$(pkgdatadir)/service-types.db\" endif -bin_PROGRAMS = zssh -desktop_DATA += zssh.desktop zvnc.desktop +bin_PROGRAMS = bssh +desktop_DATA += bssh.desktop bvnc.desktop -zssh_SOURCES = zssh.c -zssh_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS) -zssh_LDADD = $(AM_LDADD) $(GTK20_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la libavahi-ui.la +bssh_SOURCES = bssh.c +bssh_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS) +bssh_LDADD = $(AM_LDADD) $(GTK20_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la libavahi-ui.la install-exec-local: cd $(DESTDIR)/$(bindir) && \ - rm -f zvnc && \ - $(LN_S) zssh zvnc + rm -f bvnc && \ + $(LN_S) bssh bvnc -zssh.desktop: zssh.desktop.in +bssh.desktop: bssh.desktop.in sed -e 's,@bindir\@,$(bindir),g' $< > $@ -zvnc.desktop: zvnc.desktop.in +bvnc.desktop: bvnc.desktop.in sed -e 's,@bindir\@,$(bindir),g' $< > $@ endif diff --git a/avahi-ui/bssh.c b/avahi-ui/bssh.c new file mode 100644 index 0000000..32b0ccb --- /dev/null +++ b/avahi-ui/bssh.c @@ -0,0 +1,140 @@ +/* $Id$ */ + +/*** + This file is part of avahi. + + avahi is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + avahi is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General + Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with avahi; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "avahi-ui.h" + +int main(int argc, char*argv[]) { + GtkWidget *d; + + gtk_init(&argc, &argv); + + if (g_str_has_suffix(argv[0], "bvnc")) { + d = aui_service_dialog_new("Choose VNC server", NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CONNECT, GTK_RESPONSE_ACCEPT, NULL); + aui_service_dialog_set_browse_service_types(AUI_SERVICE_DIALOG(d), "_rfb._tcp", NULL); + } else { + d = aui_service_dialog_new("Choose SSH server", NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CONNECT, GTK_RESPONSE_ACCEPT, NULL); + aui_service_dialog_set_browse_service_types(AUI_SERVICE_DIALOG(d), "_ssh._tcp", NULL); + } + + aui_service_dialog_set_resolve_service(AUI_SERVICE_DIALOG(d), TRUE); + aui_service_dialog_set_resolve_host_name(AUI_SERVICE_DIALOG(d), !avahi_nss_support()); + + gtk_window_present(GTK_WINDOW(d)); + + if (gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_ACCEPT) { + char a[AVAHI_ADDRESS_STR_MAX], *u = NULL, *n = NULL; + char *h = NULL, *t = NULL; + const AvahiStringList *txt; + + t = g_strdup(aui_service_dialog_get_service_type(AUI_SERVICE_DIALOG(d))); + n = g_strdup(aui_service_dialog_get_service_name(AUI_SERVICE_DIALOG(d))); + + if (avahi_nss_support()) + 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]; + snprintf(p, sizeof(p), "%s:%u", h, aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d))-5900); + + gtk_widget_destroy(d); + + g_print("xvncviewer %s\n", p); + execlp("xvncviewer", "xvncviewer", p, NULL); + + } else { + char p[16]; + + snprintf(p, sizeof(p), "%u", aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d))); + + for (txt = aui_service_dialog_get_txt_data(AUI_SERVICE_DIALOG(d)); txt; txt = txt->next) { + char *key, *value; + + if (avahi_string_list_get_pair((AvahiStringList*) txt, &key, &value, NULL) < 0) + break; + + if (strcmp(key, "u") == 0) + u = g_strdup(value); + + avahi_free(key); + avahi_free(value); + } + + gtk_widget_destroy(d); + + if (u) { + g_print("ssh -p %s -l %s %s\n", p, u, h); + + 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); + execlp("gnome-terminal", "gnome-terminal", "-t", n, "-x", "ssh", "-p", p, "-l", u, h, NULL); + execlp("xterm", "xterm", "-T", n, "-e", "ssh", "-p", p, "-l", u, h, NULL); + } + } else { + g_print("ssh -p %s %s\n", p, h); + + 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); + execlp("gnome-terminal", "gnome-terminal", "-t", n, "-x", "ssh", "-p", p, h, NULL); + execlp("xterm", "xterm", "-T", n, "-e", "ssh", "-p", p, h, NULL); + } + } + } + + g_warning("execlp() failed: %s\n", strerror(errno)); + + g_free(h); + g_free(u); + g_free(t); + g_free(n); + + } else { + gtk_widget_destroy(d); + + g_print("Canceled.\n"); + } + + return 1; + +} diff --git a/avahi-ui/bssh.desktop.in b/avahi-ui/bssh.desktop.in new file mode 100644 index 0000000..e1d043c --- /dev/null +++ b/avahi-ui/bssh.desktop.in @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +Encoding=UTF-8 +Name=Avahi SSH Server Browser +Comment=Browse for Zeroconf-enabled SSH Servers +Exec=@bindir@/bssh +Terminal=false +Type=Application +Icon=network-wired +Categories=GNOME;Application;System;Utility; +StartupNotify=false +GenericName= diff --git a/avahi-ui/bvnc.desktop.in b/avahi-ui/bvnc.desktop.in new file mode 100644 index 0000000..a7ce686 --- /dev/null +++ b/avahi-ui/bvnc.desktop.in @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +Encoding=UTF-8 +Name=Avahi VNC Server Browser +Comment=Browse for Zeroconf-enabled VNC Servers +Exec=@bindir@/bvnc +Terminal=false +Type=Application +Icon=network-wired +Categories=GNOME;Application;System;Utility; +StartupNotify=false +GenericName= diff --git a/avahi-ui/zssh.c b/avahi-ui/zssh.c deleted file mode 100644 index b49d332..0000000 --- a/avahi-ui/zssh.c +++ /dev/null @@ -1,140 +0,0 @@ -/* $Id$ */ - -/*** - This file is part of avahi. - - avahi is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - avahi is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General - Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with avahi; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. -***/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include "avahi-ui.h" - -int main(int argc, char*argv[]) { - GtkWidget *d; - - gtk_init(&argc, &argv); - - if (g_str_has_suffix(argv[0], "zvnc")) { - d = aui_service_dialog_new("Choose VNC server", NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CONNECT, GTK_RESPONSE_ACCEPT, NULL); - aui_service_dialog_set_browse_service_types(AUI_SERVICE_DIALOG(d), "_rfb._tcp", NULL); - } else { - d = aui_service_dialog_new("Choose SSH server", NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CONNECT, GTK_RESPONSE_ACCEPT, NULL); - aui_service_dialog_set_browse_service_types(AUI_SERVICE_DIALOG(d), "_ssh._tcp", NULL); - } - - aui_service_dialog_set_resolve_service(AUI_SERVICE_DIALOG(d), TRUE); - aui_service_dialog_set_resolve_host_name(AUI_SERVICE_DIALOG(d), !avahi_nss_support()); - - gtk_window_present(GTK_WINDOW(d)); - - if (gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_ACCEPT) { - char a[AVAHI_ADDRESS_STR_MAX], *u = NULL, *n = NULL; - char *h = NULL, *t = NULL; - const AvahiStringList *txt; - - t = g_strdup(aui_service_dialog_get_service_type(AUI_SERVICE_DIALOG(d))); - n = g_strdup(aui_service_dialog_get_service_name(AUI_SERVICE_DIALOG(d))); - - if (avahi_nss_support()) - 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]; - snprintf(p, sizeof(p), "%s:%u", h, aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d))-5900); - - gtk_widget_destroy(d); - - g_print("xvncviewer %s\n", p); - execlp("xvncviewer", "xvncviewer", p, NULL); - - } else { - char p[16]; - - snprintf(p, sizeof(p), "%u", aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d))); - - for (txt = aui_service_dialog_get_txt_data(AUI_SERVICE_DIALOG(d)); txt; txt = txt->next) { - char *key, *value; - - if (avahi_string_list_get_pair((AvahiStringList*) txt, &key, &value, NULL) < 0) - break; - - if (strcmp(key, "u") == 0) - u = g_strdup(value); - - avahi_free(key); - avahi_free(value); - } - - gtk_widget_destroy(d); - - if (u) { - g_print("ssh -p %s -l %s %s\n", p, u, h); - - 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); - execlp("gnome-terminal", "gnome-terminal", "-t", n, "-x", "ssh", "-p", p, "-l", u, h, NULL); - execlp("xterm", "xterm", "-T", n, "-e", "ssh", "-p", p, "-l", u, h, NULL); - } - } else { - g_print("ssh -p %s %s\n", p, h); - - 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); - execlp("gnome-terminal", "gnome-terminal", "-t", n, "-x", "ssh", "-p", p, h, NULL); - execlp("xterm", "xterm", "-T", n, "-e", "ssh", "-p", p, h, NULL); - } - } - } - - g_warning("execlp() failed: %s\n", strerror(errno)); - - g_free(h); - g_free(u); - g_free(t); - g_free(n); - - } else { - gtk_widget_destroy(d); - - g_print("Canceled.\n"); - } - - return 1; - -} diff --git a/avahi-ui/zssh.desktop.in b/avahi-ui/zssh.desktop.in deleted file mode 100644 index 4571089..0000000 --- a/avahi-ui/zssh.desktop.in +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Version=1.0 -Encoding=UTF-8 -Name=Avahi SSH Server Browser -Comment=Browse for Zeroconf-enabled SSH Servers -Exec=@bindir@/zssh -Terminal=false -Type=Application -Icon=network-wired -Categories=GNOME;Application;System;Utility; -StartupNotify=false -GenericName= diff --git a/avahi-ui/zvnc.desktop.in b/avahi-ui/zvnc.desktop.in deleted file mode 100644 index cbeed4c..0000000 --- a/avahi-ui/zvnc.desktop.in +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Version=1.0 -Encoding=UTF-8 -Name=Avahi VNC Server Browser -Comment=Browse for Zeroconf-enabled VNC Servers -Exec=@bindir@/zvnc -Terminal=false -Type=Application -Icon=network-wired -Categories=GNOME;Application;System;Utility; -StartupNotify=false -GenericName= -- cgit