Bladeren bron

Imported Upstream version 1.3

Héctor García 10 jaren geleden
bovenliggende
commit
ffede4e2bc
10 gewijzigde bestanden met toevoegingen van 284 en 27 verwijderingen
  1. 24 0
      .gitignore
  2. 10 0
      AUTHORS
  3. 22 0
      ChangeLog
  4. 137 0
      bootstrap.sh
  5. 1 1
      configure.ac
  6. 38 0
      mssh.1
  7. 8 8
      src/mssh-gconf.c
  8. 26 4
      src/mssh-terminal.c
  9. 15 14
      src/mssh-window.c
  10. 3 0
      src/mssh.c

+ 24 - 0
.gitignore

@@ -0,0 +1,24 @@
+Makefile
+Makefile.in
+aclocal.m4
+.deps
+.libs
+*.la
+*.lo
+*.o
+*~
+autom4te.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+missing
+src/mssh
+stamp-h1

+ 10 - 0
AUTHORS

@@ -1,3 +1,13 @@
+Current Developer:
+----------------------------------------------------------------------------
+    Héctor García  <[email protected]>
+
 Founder and Lead Developer:
 ----------------------------------------------------------------------------
     Bradley Smith  <[email protected]> (United Kingdom)
+
+Contributors
+----------------------------------------------------------------------------
+    Francisco Licerán <[email protected]>
+    Mario J. Barchéin <[email protected]>
+    Oscar Fernandez <[email protected]>

+ 22 - 0
ChangeLog

@@ -1,3 +1,25 @@
+2014-01-15  Héctor García  <[email protected]>
+
+    Added patch from Oscar Fernandez to support comments on configuration archive
+
+    Added patch from Mario J. Barchéin and Francisco Licerán to support port numbers on host
+
+    Copy Debian's mssh man page to upstream and added Karl Goetz <[email protected]> patch
+
+    Allow window to be smaller than 1024x768. Patch from Lorenzo Masini <[email protected]>
+
+2014-01-15  Héctor García  <[email protected]>
+
+    Bumped version to 1.3 gtk2 deprecated symbols free
+
+    Replaced GDK_<keyname> with GDK_KEY_<keyname>
+
+    Changed direct access to use accessor for terminal->parent
+
+    Changed deprecated gtk_menu_bar_append with gtk_menu_shell_append
+
+    Migrate from vte_terminal_fork_command to vte_terminal_fork_command_full to make compile against GTK 2.24
+
 2010-01-15  Bradley Smith  <[email protected]>
 
 	Bump to version 1.2

+ 137 - 0
bootstrap.sh

@@ -0,0 +1,137 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+DIE=0
+SRCDIR=`dirname $0`
+BUILDDIR=`pwd`
+srcfile=src/mssh.c
+
+debug ()
+# print out a debug message if DEBUG is a defined variable
+{
+  if [ ! -z "$DEBUG" ]; then
+    echo "DEBUG: $1"
+  fi
+}
+
+version_check ()
+# check the version of a package
+# first argument : complain ('1') or not ('0')
+# second argument : package name (executable)
+# third argument : source download url
+# rest of arguments : major, minor, micro version
+{
+  COMPLAIN=$1
+  PACKAGE=$2
+  URL=$3
+  MAJOR=$4
+  MINOR=$5
+  MICRO=$6
+
+  WRONG=
+
+  debug "major $MAJOR minor $MINOR micro $MICRO"
+  VERSION=$MAJOR
+  if [ ! -z "$MINOR" ]; then VERSION=$VERSION.$MINOR; else MINOR=0; fi
+  if [ ! -z "$MICRO" ]; then VERSION=$VERSION.$MICRO; else MICRO=0; fi
+
+  debug "version $VERSION"
+  echo "+ checking for $PACKAGE >= $VERSION ... " | tr -d '\n'
+
+  ($PACKAGE --version) < /dev/null > /dev/null 2>&1 ||
+  {
+    echo
+    echo "You must have $PACKAGE installed to compile $package."
+    echo "Download the appropriate package for your distribution,"
+    echo "or get the source tarball at $URL"
+    return 1
+  }
+  # the following line is carefully crafted sed magic
+  pkg_version=`$PACKAGE --version|head -n 1|sed 's/([^)]*)//g;s/^[a-zA-Z\.\ \-\/]*//;s/ .*$//'`
+  debug "pkg_version $pkg_version"
+  pkg_major=`echo $pkg_version | cut -d. -f1`
+  pkg_minor=`echo $pkg_version | sed s/[-,a-z,A-Z].*// | cut -d. -f2`
+  pkg_micro=`echo $pkg_version | sed s/[-,a-z,A-Z].*// | cut -d. -f3`
+  [ -z "$pkg_minor" ] && pkg_minor=0
+  [ -z "$pkg_micro" ] && pkg_micro=0
+
+  debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
+
+  #start checking the version
+  if [ "$pkg_major" -lt "$MAJOR" ]; then
+    WRONG=1
+  elif [ "$pkg_major" -eq "$MAJOR" ]; then
+    if [ "$pkg_minor" -lt "$MINOR" ]; then
+      WRONG=1
+    elif [ "$pkg_minor" -eq "$MINOR" -a "$pkg_micro" -lt "$MICRO" ]; then
+      WRONG=1
+    fi
+  fi
+
+  if [ ! -z "$WRONG" ]; then
+   echo "found $pkg_version, not ok !"
+   if [ "$COMPLAIN" -eq "1" ]; then
+     echo
+     echo "You must have $PACKAGE $VERSION or greater to compile $package."
+     echo "Get the latest version from <$URL>."
+     echo
+   fi
+   return 1
+  else
+    echo "found $pkg_version, ok."
+  fi
+}
+
+version_check 1 "pkg-config" "http://pkgconfig.freedesktop.org/" 0 9 || DIE=1
+version_check 1 "autoconf" "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 56 || DIE=1
+version_check 1 "automake" "ftp://ftp.gnu.org/pub/gnu/automake/" 1 9 || DIE=1
+if [ "$DIE" -eq 1 ]; then
+  exit 1
+fi
+
+
+# Chdir to the srcdir, then run auto* tools.
+cd $SRCDIR
+
+[ -f $srcfile ] || {
+  echo "Are you sure $SRCDIR is a valid source directory?"
+  exit 1
+}
+
+echo "+ running aclocal ..."
+aclocal || {
+  echo
+  echo "aclocal failed - check that all needed development files are present on system"
+  exit 1
+}
+echo "+ running autoconf ... "
+autoconf || {
+  echo
+  echo "autoconf failed"
+  exit 1
+}
+echo "+ running autoheader ... "
+autoheader || {
+  echo
+  echo "autoheader failed"
+  exit 1
+}
+echo "+ running automake ... "
+automake -a -c || {
+  echo
+  echo "automake failed"
+  exit 1
+}
+
+# Chdir back to the builddir before the configure step.
+cd $BUILDDIR
+
+# now remove the cache, because it can be considered dangerous in this case
+echo "+ Tidying up ... "
+rm -fr autom4te.cache config.h.in\~
+
+echo
+echo "Done."
+
+exit 0
+

+ 1 - 1
configure.ac

@@ -1,4 +1,4 @@
-AC_INIT([MultiSSH], [1.2], [[email protected]], [mssh])
+AC_INIT([MultiSSH], [1.3], [[email protected]], [mssh])
 AM_CONFIG_HEADER([config.h])
 AM_INIT_AUTOMAKE
 

+ 38 - 0
mssh.1

@@ -0,0 +1,38 @@
+.TH MSSH 1
+.SH NAME
+mssh \- tool to administrate multiple servers at once
+.SH SYNOPSIS
+.B mssh
+[\fIOPTION\fR]... (-a \fIALIAS\fR | \fIHOSTS\fR[\fI:PORT\fR])
+.SH DESCRIPTION
+.B MultiSSH
+is a GTK+ based ssh client to issue the same commands to multiple servers.
+
+.B MultiSSH
+will connect to the servers specified in \fIHOSTS\fR into optional \fIPORT\fR.
+.SH OPTIONS
+.TP
+\fB-a\fR, \fB\-\-alias\fR=\fIALIAS\fR
+Open hosts associated with named alias
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display this help and exit
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Output version information and exit
+.SH CONFIGURATION
+The configuration file for
+.B MultiSSH
+should be located in
+.B $HOME/.mssh_clusters
+
+It uses a simple key: pair system with an alias on the left of the
+colon and a space separated list of hosts on the right.
+
+.SH AUTHOR
+.B MultiSSH
+was written by Bradley Smith <brad@brad\-smith.co.uk>
+.SH COPYRIGHT
+Copyright (C) 2009 Bradley Smith <brad@brad\-smith.co.uk>
+.SH REPORTING BUGS
+Report bugs to <brad@brad\-smith.co.uk>.

+ 8 - 8
src/mssh-gconf.c

@@ -184,13 +184,13 @@ void mssh_gconf_notify_modifier(GConfClient *client, guint cnxn_id,
 
     if(window->accel)
     {
-        gtk_accel_group_disconnect_key(window->accel, GDK_Up,
+        gtk_accel_group_disconnect_key(window->accel, GDK_KEY_Up,
             window->modifier);
-        gtk_accel_group_disconnect_key(window->accel, GDK_Down,
+        gtk_accel_group_disconnect_key(window->accel, GDK_KEY_Down,
             window->modifier);
-        gtk_accel_group_disconnect_key(window->accel, GDK_Left,
+        gtk_accel_group_disconnect_key(window->accel, GDK_KEY_Left,
             window->modifier);
-        gtk_accel_group_disconnect_key(window->accel, GDK_Right,
+        gtk_accel_group_disconnect_key(window->accel, GDK_KEY_Right,
             window->modifier);
     }
 
@@ -198,16 +198,16 @@ void mssh_gconf_notify_modifier(GConfClient *client, guint cnxn_id,
 
     if(window->accel)
     {
-        gtk_accel_group_connect(window->accel, GDK_Up, window->modifier,
+        gtk_accel_group_connect(window->accel, GDK_KEY_Up, window->modifier,
             GTK_ACCEL_VISIBLE, g_cclosure_new(
             G_CALLBACK(mssh_window_focus), window, NULL));
-        gtk_accel_group_connect(window->accel, GDK_Down, window->modifier,
+        gtk_accel_group_connect(window->accel, GDK_KEY_Down, window->modifier,
             GTK_ACCEL_VISIBLE, g_cclosure_new(
             G_CALLBACK(mssh_window_focus), window, NULL));
-        gtk_accel_group_connect(window->accel, GDK_Left, window->modifier,
+        gtk_accel_group_connect(window->accel, GDK_KEY_Left, window->modifier,
             GTK_ACCEL_VISIBLE, g_cclosure_new(
             G_CALLBACK(mssh_window_focus), window, NULL));
-        gtk_accel_group_connect(window->accel, GDK_Right, window->modifier,
+        gtk_accel_group_connect(window->accel, GDK_KEY_Right, window->modifier,
             GTK_ACCEL_VISIBLE, g_cclosure_new(
             G_CALLBACK(mssh_window_focus), window, NULL));
     }

+ 26 - 4
src/mssh-terminal.c

@@ -40,14 +40,36 @@ void mssh_terminal_init_session(MSSHTerminal *terminal, char *hostname)
 
 void mssh_terminal_start_session(MSSHTerminal *terminal, char **env)
 {
-    char *args[3];
+    char *args[5];
+    char *fullhost;
+    char *host = NULL;
+    char *port = NULL;
+
+    fullhost = strdup(terminal->hostname);
+    host = strtok(fullhost, ":");
+    port = strtok(NULL, "");
 
     args[0] = strdup("ssh");
     args[1] = terminal->hostname;
-    args[2] = NULL;
 
-    vte_terminal_fork_command(VTE_TERMINAL(terminal), "ssh", args,
-        env, NULL, FALSE, FALSE, FALSE);
+    if (!port)
+        args[2] = NULL;
+    else {
+         args[2] = "-p";
+         args[3] = port;
+         args[4] = NULL;
+    }
+
+    vte_terminal_fork_command_full(VTE_TERMINAL(terminal),
+                                   VTE_PTY_NO_LASTLOG|VTE_PTY_NO_UTMP|VTE_PTY_NO_WTMP,
+                                   NULL,  /* working dir */
+                                   args,
+                                   env,
+                                   G_SPAWN_SEARCH_PATH,
+                                   NULL,  /* child_setup */
+                                   NULL,  /* child_setup_data */
+                                   NULL,  /* *child_pid */
+                                   NULL); /* Error handling */
 
     free(args[0]);
 }

+ 15 - 14
src/mssh-window.c

@@ -136,7 +136,7 @@ gboolean mssh_window_focus(GtkWidget *widget, GObject *acceleratable,
         }
     }
 
-    if(focus == window->global_entry && keyval == GDK_Down &&
+    if(focus == window->global_entry && keyval == GDK_KEY_Down &&
         window->dir_focus)
         idx = 0;
     else if(idx == -1 && window->dir_focus)
@@ -145,11 +145,11 @@ gboolean mssh_window_focus(GtkWidget *widget, GObject *acceleratable,
     {
         switch(keyval)
         {
-        case GDK_Up:
+        case GDK_KEY_Up:
             if(window->dir_focus)
                 idx = idx - cols;
             break;
-        case GDK_Down:
+        case GDK_KEY_Down:
             if(window->dir_focus)
             {
                 if((idx + cols >= len) && (idx < len -
@@ -159,11 +159,11 @@ gboolean mssh_window_focus(GtkWidget *widget, GObject *acceleratable,
                     idx = idx + cols;
             }
             break;
-        case GDK_Left:
+        case GDK_KEY_Left:
             if(idx % cols != 0 || !window->dir_focus)
                 idx = idx - 1;
             break;
-        case GDK_Right:
+        case GDK_KEY_Right:
             if(idx % cols != cols - 1 || !window->dir_focus)
                 idx = idx + 1;
             break;
@@ -304,7 +304,7 @@ void mssh_window_relayout(MSSHWindow *window)
             MSSHTerminal*, i);
 
         g_object_ref(terminal);
-        if(GTK_WIDGET(terminal)->parent == GTK_WIDGET(window->table))
+        if(gtk_widget_get_parent(GTK_WIDGET(terminal)) == GTK_WIDGET(window->table))
         {
             gtk_container_remove(GTK_CONTAINER(window->table),
                 GTK_WIDGET(terminal));
@@ -415,9 +415,9 @@ static void mssh_window_init(MSSHWindow* window)
     g_signal_connect(G_OBJECT(edit_pref), "activate",
         G_CALLBACK(mssh_window_pref), window);
 
-    gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), file_item);
-    gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), edit_item);
-    gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), server_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), edit_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), server_item);
 
     g_signal_connect(G_OBJECT(entry), "key-press-event",
         G_CALLBACK(mssh_window_key_press), window);
@@ -434,7 +434,8 @@ static void mssh_window_init(MSSHWindow* window)
 
     gtk_container_add(GTK_CONTAINER(window), vbox);
 
-    gtk_widget_set_size_request(GTK_WIDGET(window), 1024, 768);
+    gtk_widget_set_size_request(GTK_WIDGET(window), 0, 0);
+    gtk_window_set_default_size(GTK_WINDOW(window), 1024, 768);
     gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME);
 
     client = gconf_client_get_default();
@@ -468,16 +469,16 @@ static void mssh_window_init(MSSHWindow* window)
     gconf_client_notify(client, MSSH_GCONF_KEY_DIR_FOCUS);
     gconf_client_notify(client, MSSH_GCONF_KEY_MODIFIER);
 
-    gtk_accel_group_connect(accel, GDK_Up, window->modifier,
+    gtk_accel_group_connect(accel, GDK_KEY_Up, window->modifier,
         GTK_ACCEL_VISIBLE, g_cclosure_new(
         G_CALLBACK(mssh_window_focus), window, NULL));
-    gtk_accel_group_connect(accel, GDK_Down, window->modifier,
+    gtk_accel_group_connect(accel, GDK_KEY_Down, window->modifier,
         GTK_ACCEL_VISIBLE, g_cclosure_new(
         G_CALLBACK(mssh_window_focus), window, NULL));
-    gtk_accel_group_connect(accel, GDK_Left, window->modifier,
+    gtk_accel_group_connect(accel, GDK_KEY_Left, window->modifier,
         GTK_ACCEL_VISIBLE, g_cclosure_new(
         G_CALLBACK(mssh_window_focus), window, NULL));
-    gtk_accel_group_connect(accel, GDK_Right, window->modifier,
+    gtk_accel_group_connect(accel, GDK_KEY_Right, window->modifier,
         GTK_ACCEL_VISIBLE, g_cclosure_new(
         G_CALLBACK(mssh_window_focus), window, NULL));
 

+ 3 - 0
src/mssh.c

@@ -121,6 +121,9 @@ GData **parse_aliases(char *conffile)
         if(strcmp(line, "") == 0)
             continue;
 
+        if( *line == '#')
+            continue;
+
         if((sep = strchr(line, ':')) == NULL)
         {
             printf("Line %d: Failed to parse line '%s'\n", lineno, line);