From 4f8f9383692f5230de036aed8c4e370dcb5a3c0a Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Mon, 12 Mar 2012 04:49:00 -0400 Subject: [PATCH] Add versions and no-warranty msg to mosh, mosh-client, mosh-server --- scripts/mosh | 21 ++++++++++++++++++++- src/frontend/mosh-client.cc | 6 ++++++ src/frontend/mosh-server.cc | 4 ++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/scripts/mosh b/scripts/mosh index a1147e1..78f56d0 100755 --- a/scripts/mosh +++ b/scripts/mosh @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +my $MOSH_VERSION = '0.98c'; + use warnings; use strict; use Socket; @@ -31,6 +33,9 @@ my $predict = undef; my $port_request = undef; +my $help = undef; +my $version = undef; + my $usage = qq{Usage: $0 [options] [user@]host --client=PATH mosh client on local machine @@ -44,8 +49,17 @@ qq{Usage: $0 [options] [user@]host -p NUM --port=NUM server-side UDP port + --help this message + --version + Please report bugs to mosh-devel\@mit.edu. -Mosh home page: http://mosh.mit.edu\n}; +Mosh home page: http://mosh.mit.edu + +mosh $MOSH_VERSION +Copyright 2012 Keith Winstein +License GPLv3+: GNU GPL version 3 or later . +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law.\n}; sub predict_check { my ( $predict, $env_set ) = @_; @@ -65,8 +79,13 @@ GetOptions( 'client=s' => \$client, 'a' => sub { $predict = 'always' }, 'n' => sub { $predict = 'never' }, 'p=i' => \$port_request, + 'help' => \$help, + 'version' => \$version, 'fake-proxy!' => \my $fake_proxy ) or die $usage; +die $usage if ( defined $help ); +die "mosh $MOSH_VERSION\n" if ( defined $version ); + if ( defined $predict ) { predict_check( $predict, 0 ); } elsif ( defined $ENV{ 'MOSH_PREDICTION_DISPLAY' } ) { diff --git a/src/frontend/mosh-client.cc b/src/frontend/mosh-client.cc index b61e648..c97ff45 100644 --- a/src/frontend/mosh-client.cc +++ b/src/frontend/mosh-client.cc @@ -16,6 +16,8 @@ along with this program. If not, see . */ +#include "config.h" + #include #include @@ -23,6 +25,10 @@ #include "crypto.h" void usage( const char *argv0 ) { + fprintf( stderr, "mosh-client (%s)\n", PACKAGE_STRING ); + fprintf( stderr, "Copyright 2012 Keith Winstein \n" ); + fprintf( stderr, "License GPLv3+: GNU GPL version 3 or later .\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\n" ); + fprintf( stderr, "Usage: %s IP PORT\n", argv0 ); } diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index 5ab1f16..47323c2 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -153,6 +153,10 @@ int run_server( const char *desired_ip, const char *desired_port ) { fprintf( stderr, "[mosh-server detached, pid = %d]\n", (int)getpid() ); + fprintf( stderr, "\nmosh-server (%s)\n", PACKAGE_STRING ); + fprintf( stderr, "Copyright 2012 Keith Winstein \n" ); + fprintf( stderr, "License GPLv3+: GNU GPL version 3 or later .\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\n" ); + int master; if ( !(child_termios.c_iflag & IUTF8) ) {