Support port range as -p/--port PORT[:HIGHPORT].
Extend mosh and mosh-server to support parsing a high port from the desired_port argument. The first (low) port must not be greater than the second (high) port. If only one value is provided, behaviour is as before; bind to one port. Also tweak the formatting in mosh-server(1) synopsis to be consistent. This resolves mosh issue # 296. Signed-off-by: Luke Mewburn <luke@mewburn.net>
This commit is contained in:
committed by
Keith Winstein
parent
b99da057bb
commit
141ec239da
@@ -103,7 +103,7 @@ using namespace std;
|
||||
|
||||
void print_usage( const char *argv0 )
|
||||
{
|
||||
fprintf( stderr, "Usage: %s new [-s] [-v] [-i LOCALADDR] [-p PORT] [-c COLORS] [-l NAME=VALUE] [-- COMMAND...]\n", argv0 );
|
||||
fprintf( stderr, "Usage: %s new [-s] [-v] [-i LOCALADDR] [-p PORT[:PORT2]] [-c COLORS] [-l NAME=VALUE] [-- COMMAND...]\n", argv0 );
|
||||
}
|
||||
|
||||
void print_motd( void );
|
||||
@@ -235,9 +235,9 @@ int main( int argc, char *argv[] )
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
if ( desired_port
|
||||
&& ( strspn( desired_port, "0123456789" ) != strlen( desired_port ) ) ) {
|
||||
fprintf( stderr, "%s: Bad UDP port (%s)\n", argv[ 0 ], desired_port );
|
||||
int dpl, dph;
|
||||
if ( desired_port && ! Connection::parse_portrange( desired_port, dpl, dph ) ) {
|
||||
fprintf( stderr, "%s: Bad UDP port range (%s)\n", argv[ 0 ], desired_port );
|
||||
print_usage( argv[ 0 ] );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user