Use environment variable to convey prediction display preference

This commit is contained in:
Keith Winstein
2012-02-13 06:07:26 -05:00
parent f6d8b4cb38
commit 309e38d889
2 changed files with 32 additions and 13 deletions
+7 -9
View File
@@ -23,7 +23,7 @@
#include "crypto.h"
void usage( const char *argv0 ) {
fprintf( stderr, "Usage: %s IP PORT [always|never|adaptive]\n", argv0 );
fprintf( stderr, "Usage: %s IP PORT\n", argv0 );
}
int main( int argc, char *argv[] )
@@ -32,14 +32,8 @@ int main( int argc, char *argv[] )
char *ip;
int port;
char *predict_mode = NULL;
if ( argc == 4 ) {
predict_mode = argv[ 3 ];
} else if ( argc == 3 ) {
/* do nothing */
} else {
usage( argv[ 0 ]);
if ( argc != 3 ) {
usage( argv[ 0 ] );
exit( 1 );
}
@@ -53,6 +47,10 @@ int main( int argc, char *argv[] )
exit( 1 );
}
/* Read prediction preference */
char *predict_mode = getenv( "MOSH_PREDICTION_DISPLAY" );
/* can be NULL */
char *key = strdup( env_key );
if ( key == NULL ) {
perror( "strdup" );