mirror of
https://github.com/transmission/transmission
synced 2025-01-02 21:16:04 +00:00
Update 2005-11-26
This commit is contained in:
parent
835c3284dd
commit
5b06d13781
2 changed files with 20 additions and 6 deletions
|
@ -564,14 +564,14 @@ int tr_trackerScrape( tr_torrent_t * tor, int * seeders, int * leechers )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < ret - 8; i++ )
|
for( i = 0; i < pos - 8; i++ )
|
||||||
{
|
{
|
||||||
if( !memcmp( &buf[i], "d5:files", 8 ) )
|
if( !memcmp( &buf[i], "d5:files", 8 ) )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( i >= ret - 8 )
|
if( i >= pos - 8 )
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -623,4 +623,4 @@ int tr_trackerLeechers( tr_torrent_t * tor)
|
||||||
return (tor->tracker)->leechers;
|
return (tor->tracker)->leechers;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
" -s, --scrape Print counts of seeders/leechers and exit\n" \
|
" -s, --scrape Print counts of seeders/leechers and exit\n" \
|
||||||
" -v, --verbose <int> Verbose level (0 to 2, default = 0)\n" \
|
" -v, --verbose <int> Verbose level (0 to 2, default = 0)\n" \
|
||||||
" -p, --port <int> Port we should listen on (default = %d)\n" \
|
" -p, --port <int> Port we should listen on (default = %d)\n" \
|
||||||
" -u, --upload <int> Maximum upload rate (-1 = no limit, default = 20)\n"
|
" -u, --upload <int> Maximum upload rate (-1 = no limit, default = 20)\n" \
|
||||||
|
" -f, --finish <shell script> Command you wish to run on completion\n"
|
||||||
|
|
||||||
static int showHelp = 0;
|
static int showHelp = 0;
|
||||||
static int showInfo = 0;
|
static int showInfo = 0;
|
||||||
|
@ -51,6 +52,8 @@ static int uploadLimit = 20;
|
||||||
static char * torrentPath = NULL;
|
static char * torrentPath = NULL;
|
||||||
static volatile char mustDie = 0;
|
static volatile char mustDie = 0;
|
||||||
|
|
||||||
|
static char * finishCall = NULL;
|
||||||
|
|
||||||
static int parseCommandLine ( int argc, char ** argv );
|
static int parseCommandLine ( int argc, char ** argv );
|
||||||
static void sigHandler ( int signal );
|
static void sigHandler ( int signal );
|
||||||
|
|
||||||
|
@ -166,6 +169,7 @@ int main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
char string[80];
|
char string[80];
|
||||||
int chars = 0;
|
int chars = 0;
|
||||||
|
int result;
|
||||||
|
|
||||||
sleep( 1 );
|
sleep( 1 );
|
||||||
|
|
||||||
|
@ -204,6 +208,12 @@ int main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "\n" );
|
fprintf( stderr, "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( tr_getFinished( h, 0 ) )
|
||||||
|
{
|
||||||
|
tr_setFinished( h, 0, 0 );
|
||||||
|
result = system(finishCall);
|
||||||
|
}
|
||||||
|
|
||||||
free( s );
|
free( s );
|
||||||
}
|
}
|
||||||
|
@ -244,10 +254,11 @@ static int parseCommandLine( int argc, char ** argv )
|
||||||
{ "verbose", required_argument, NULL, 'v' },
|
{ "verbose", required_argument, NULL, 'v' },
|
||||||
{ "port", required_argument, NULL, 'p' },
|
{ "port", required_argument, NULL, 'p' },
|
||||||
{ "upload", required_argument, NULL, 'u' },
|
{ "upload", required_argument, NULL, 'u' },
|
||||||
{ 0, 0, 0, 0 } };
|
{ "finish", required_argument, NULL, 'f' },
|
||||||
|
{ 0, 0, 0, 0} };
|
||||||
|
|
||||||
int c, optind = 0;
|
int c, optind = 0;
|
||||||
c = getopt_long( argc, argv, "hisv:p:u:", long_options, &optind );
|
c = getopt_long( argc, argv, "hisv:p:u:f:", long_options, &optind );
|
||||||
if( c < 0 )
|
if( c < 0 )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -272,6 +283,9 @@ static int parseCommandLine( int argc, char ** argv )
|
||||||
case 'u':
|
case 'u':
|
||||||
uploadLimit = atoi( optarg );
|
uploadLimit = atoi( optarg );
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
finishCall = optarg;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue