Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a -u flag in mosh-server to print detached mosh sessions th… #1327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/frontend/mosh-server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,15 @@ static void print_version( FILE* file )
static void print_usage( FILE* stream, const char* argv0 )
{
fprintf( stream,
"Usage: %s new [-s] [-v] [-i LOCALADDR] [-p PORT[:PORT2]] [-c COLORS] [-l NAME=VALUE] [-- COMMAND...]\n",
"Usage: %s new [-s] [-u] [-v] [-i LOCALADDR] [-p PORT[:PORT2]] [-c COLORS] [-l NAME=VALUE] [-- COMMAND...]\n",
argv0 );
}

static bool print_motd( const char* filename );
static void chdir_homedir( void );
static bool motd_hushed( void );
static void warn_unattached( const std::string& ignore_entry );
static char utmp_entry[64] = { 0 };

/* Simple spinloop */
static void spin( void )
Expand Down Expand Up @@ -203,6 +204,11 @@ int main( int argc, char* argv[] )
print_version( stdout );
exit( 0 );
}
if ( 0 == strcmp( argv[i], "-u" ) ) {
snprintf( utmp_entry, 64, "mosh [%ld]", static_cast<long int>( getpid() ) );
warn_unattached( utmp_entry );
exit( 0 );
}
if ( 0 == strcmp( argv[i], "--" ) ) { /* -- is mandatory */
if ( i != argc - 1 ) {
command_argv = argv + i + 1;
Expand Down Expand Up @@ -513,7 +519,6 @@ static int run_server( const char* desired_ip,
}
}

char utmp_entry[64] = { 0 };
snprintf( utmp_entry, 64, "mosh [%ld]", static_cast<long int>( getpid() ) );

/* Fork child process */
Expand Down