|
@@ -2,6 +2,7 @@
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <string.h>
|
|
#include <getopt.h>
|
|
#include <getopt.h>
|
|
|
|
+#include <errno.h>
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
@@ -27,6 +28,8 @@ void usage(const char *argv0)
|
|
argv0);
|
|
argv0);
|
|
fprintf(stderr,
|
|
fprintf(stderr,
|
|
" -a, --alias=ALIAS Open hosts associated with named alias\n");
|
|
" -a, --alias=ALIAS Open hosts associated with named alias\n");
|
|
|
|
+ fprintf(stderr,
|
|
|
|
+ " -c, --columns=NUM Override gconf for number of columns\n");
|
|
fprintf(stderr,
|
|
fprintf(stderr,
|
|
" -h, --help Display this help and exit\n");
|
|
" -h, --help Display this help and exit\n");
|
|
fprintf(stderr,
|
|
fprintf(stderr,
|
|
@@ -161,12 +164,14 @@ int main(int argc, char* argv[], char* env[])
|
|
GtkWidget* window;
|
|
GtkWidget* window;
|
|
int c, option_index = 0;
|
|
int c, option_index = 0;
|
|
char *home, *conffile;
|
|
char *home, *conffile;
|
|
|
|
+ long cols = 0;
|
|
GData **aliases = NULL;
|
|
GData **aliases = NULL;
|
|
GArray *hosts = NULL;
|
|
GArray *hosts = NULL;
|
|
|
|
|
|
static struct option long_options[] =
|
|
static struct option long_options[] =
|
|
{
|
|
{
|
|
{"alias", required_argument, 0, 'a'},
|
|
{"alias", required_argument, 0, 'a'},
|
|
|
|
+ {"columns", required_argument, 0, 'c'},
|
|
{"help", no_argument, 0, 'h'},
|
|
{"help", no_argument, 0, 'h'},
|
|
{"version", no_argument, 0, 'V'},
|
|
{"version", no_argument, 0, 'V'},
|
|
{0, 0, 0, 0}
|
|
{0, 0, 0, 0}
|
|
@@ -190,7 +195,7 @@ int main(int argc, char* argv[], char* env[])
|
|
|
|
|
|
for(;;)
|
|
for(;;)
|
|
{
|
|
{
|
|
- c = getopt_long(argc, argv, "a:hV", long_options, &option_index);
|
|
|
|
|
|
+ c = getopt_long(argc, argv, "a:c:hV", long_options, &option_index);
|
|
|
|
|
|
if(c == -1)
|
|
if(c == -1)
|
|
break;
|
|
break;
|
|
@@ -201,10 +206,20 @@ int main(int argc, char* argv[], char* env[])
|
|
if(aliases && (hosts = g_datalist_get_data(aliases,
|
|
if(aliases && (hosts = g_datalist_get_data(aliases,
|
|
optarg)) == NULL)
|
|
optarg)) == NULL)
|
|
{
|
|
{
|
|
- fprintf(stderr, "Alias '%s' not found\n", optarg);
|
|
|
|
|
|
+ fprintf(stderr, "Alias '%s' not found\n\n", optarg);
|
|
usage(argv[0]);
|
|
usage(argv[0]);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+ case 'c':
|
|
|
|
+ errno = 0;
|
|
|
|
+ cols = strtol(optarg, NULL, 10);
|
|
|
|
+ if(cols <= 0 || errno != 0)
|
|
|
|
+ {
|
|
|
|
+ fprintf(stderr, "Invalid number of columns '%s'\n\n",
|
|
|
|
+ optarg);
|
|
|
|
+ usage(argv[0]);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
case 'h':
|
|
case 'h':
|
|
usage(argv[0]);
|
|
usage(argv[0]);
|
|
break;
|
|
break;
|
|
@@ -271,7 +286,7 @@ int main(int argc, char* argv[], char* env[])
|
|
g_signal_connect(G_OBJECT(window), "destroy",
|
|
g_signal_connect(G_OBJECT(window), "destroy",
|
|
G_CALLBACK(on_mssh_destroy), NULL);
|
|
G_CALLBACK(on_mssh_destroy), NULL);
|
|
|
|
|
|
- mssh_window_start_session(MSSH_WINDOW(window), env, hosts);
|
|
|
|
|
|
+ mssh_window_start_session(MSSH_WINDOW(window), env, hosts, cols);
|
|
|
|
|
|
gtk_widget_show_all(window);
|
|
gtk_widget_show_all(window);
|
|
gtk_main();
|
|
gtk_main();
|