Skip to content

Commit

Permalink
[mosh] Initialize options only if not provided on the command line
Browse files Browse the repository at this point in the history
mobile-shell#431

Declare option variables as undef, and only provide a default value
if options were not provided on the command line in preparation for
obtaining values from a configuration file.

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
  • Loading branch information
earlchew committed Dec 10, 2017
1 parent 977e416 commit 546e644
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions scripts/mosh
Original file line number Diff line number Diff line change
Expand Up @@ -413,23 +413,23 @@ $|=1;

my $configFile = ConfigFile->new([ '~', '.mosh', 'config' ]);

my $client = 'mosh-client';
my $server = 'mosh-server';
my $client = undef;
my $server = undef;

my $predict = undef;

my $bind_ip = undef;

my $family = 'inet';
my $family = undef;
my $port_request = undef;
my %port_setting = (
firewall_port => 0,
server_port => 0,
port_range => 0 );

my $ssh = 'ssh';
my $ssh = undef;

my $term_init = 1;
my $term_init = undef;

my $help = undef;
my $version = undef;
Expand Down Expand Up @@ -564,6 +564,12 @@ if ( scalar @ARGV < 1 ) {
my $userhost = shift;
my @command = @ARGV;

$client = 'mosh-client' unless defined($client);
$server = 'mosh-server' unless defined($server);
$ssh = 'ssh' unless defined($ssh);
$term_init = 1 unless defined($term_init);
$family = 'inet' unless defined($family);

if ( defined $predict ) {
predict_check( $predict, 0 );
} elsif ( defined $ENV{ 'MOSH_PREDICTION_DISPLAY' } ) {
Expand Down

0 comments on commit 546e644

Please sign in to comment.