From 73315c608c7c6fd528fe9cb3570a4d792aab5b69 Mon Sep 17 00:00:00 2001 From: Matthieu Boutier Date: Sat, 25 Jul 2015 19:57:08 +0200 Subject: [PATCH] Add an option to print the server's supported extensions. --- man/mosh-server.1 | 11 +++++++++++ src/frontend/mosh-server.cc | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/man/mosh-server.1 b/man/mosh-server.1 index ec36a31..4532bc1 100644 --- a/man/mosh-server.1 +++ b/man/mosh-server.1 @@ -30,6 +30,10 @@ new [\-m \fILOSS-TOLERANCE\fP] [\-\- command...] .br +.B mosh-server +new +\-e +.br .SH DESCRIPTION \fBmosh-server\fP is a helper program for the .BR mosh(1) @@ -105,6 +109,13 @@ duplicate on each different path until the product of the loss ratio of the used paths is less than the tolerance (or no more different paths are available). The default is 0. +.TP +.B \-e +Print the supported extensions, and exit. The format is standard and can be +parsed. It begins by one header line with the package name and the build +version, followed by multiple lines having each the name and the supported +options of an extension. + .SH EXAMPLE .nf diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index 6fb7987..3ea1e75 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -105,7 +105,8 @@ using namespace std; static void print_usage( const char *argv0 ) { fprintf( stderr, "Usage: %s new [-s] [-v] [-i LOCALADDR] [-p PORT[:PORT2]] [-c COLORS] [-l NAME=VALUE] [-a] " - "[-f ] [-d ] [-m ] [-- COMMAND...]\n", argv0 ); + "[-f ] [-d ] [-m ] [-- COMMAND...]\n" + " %s new -e\n", argv0 ); } static void print_motd( void ); @@ -190,7 +191,7 @@ int main( int argc, char *argv[] ) && (strcmp( argv[ 1 ], "new" ) == 0) ) { /* new option syntax */ int opt; - while ( (opt = getopt( argc - 1, argv + 1, "ai:p:c:svl:d:f:m:" )) != -1 ) { + while ( (opt = getopt( argc - 1, argv + 1, "aei:p:c:svl:d:f:m:" )) != -1 ) { switch ( opt ) { case 'a': detach = false; @@ -236,6 +237,14 @@ int main( int argc, char *argv[] ) case 'm': loss_ratio_tolerance = atoi( optarg ); break; + case 'e': + printf( "mosh-server (%s) [build %s]\n", PACKAGE_STRING, BUILD_VERSION ); + /* list of supported extensions and options: */ + printf( " standard eipcsvl\n" + " debug adf\n" + " multipath m\n" ); + exit(0); + break; default: print_usage( argv[ 0 ] ); /* don't die on unknown options */ -- 2.3.2 (Apple Git-55)