(libT) let tr_getopt() support short options' arguments to be embedded, such as -p51413
This commit is contained in:
parent
7dcbfaf91b
commit
1010c9d35b
|
@ -239,11 +239,11 @@ main( int argc, char ** argv )
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
if( peerPort < 1 || peerPort > 65535 ) {
|
||||
printf( "Invalid port '%d'\n", peerPort );
|
||||
printf( "Error: Port must between 1 and 65535; got %d\n", peerPort );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if( peerSocketTOS < 0 || peerSocketTOS > 255 ) {
|
||||
printf( "Invalid TOS '%d'\n", peerSocketTOS );
|
||||
printf( "Error: Port must between 0 and 255; got %d\n", peerSocketTOS );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ main( int argc, char ** argv )
|
|||
|
||||
if( gotsig ) {
|
||||
gotsig = 0;
|
||||
printf( "stopping torrent...\n" );
|
||||
printf( "\nStopping torrent...\n" );
|
||||
tr_torrentStop( tor );
|
||||
}
|
||||
|
||||
|
|
|
@ -136,8 +136,9 @@ findOption( const tr_option * opts,
|
|||
return o;
|
||||
}
|
||||
len = strlen( o->shortName );
|
||||
if( !memcmp( o->shortName, str+1, len ) && str[len+1]=='=' ) {
|
||||
if( nested ) *nested = str+len+2;
|
||||
if( !memcmp( o->shortName, str+1, len ) ) {
|
||||
if( nested )
|
||||
*nested = str[len+1]=='=' ? str+len+2 : str+len+1;
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue