From 3d76ec82088a92145f892c3165e8ad151880e3f4 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Tue, 10 Apr 2012 13:19:42 +0930 Subject: [PATCH] Skip 'new' otherwise BSD getopt will think there are no options. IMO 'new' should be dropped entirely since it's not optional and 'new' is the only choice. If it were to change in future then it should go after all the options. (closes #111) --- src/frontend/mosh-server.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index 9d51135..9a00d42 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -131,7 +131,7 @@ int main( int argc, char *argv[] ) && (strcmp( argv[ 1 ], "new" ) == 0) ) { /* new option syntax */ int opt; - while ( (opt = getopt( argc, argv, "i:p:c:s" )) != -1 ) { + while ( (opt = getopt( argc - 1, argv + 1, "i:p:c:s" )) != -1 ) { switch ( opt ) { case 'i': desired_ip = optarg;