diff options
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/opentracker.c b/opentracker.c index b992117..b7c1f6a 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -342,10 +342,37 @@ void graceful( int s ) { | |||
342 | void usage( char *name ) { | 342 | void usage( char *name ) { |
343 | fprintf( stderr, "Usage: %s [-i serverip] [-p serverport] [-d serverdirectory]" | 343 | fprintf( stderr, "Usage: %s [-i serverip] [-p serverport] [-d serverdirectory]" |
344 | #ifdef WANT_CLOSED_TRACKER | 344 | #ifdef WANT_CLOSED_TRACKER |
345 | " [-o|c]" | 345 | " [-oc]" |
346 | #endif | ||
347 | #ifdef WANT_BLACKLIST | ||
348 | " [-bB]" | ||
346 | #endif | 349 | #endif |
347 | "\n", name ); | 350 | "\n", name ); |
348 | exit(1); | 351 | } |
352 | |||
353 | void help( char *name ) { | ||
354 | usage( name ); | ||
355 | fprintf( stderr, "\t-i serverip\tspecify ip to bind to (default: *)\n" | ||
356 | "\t-p serverport\tspecify port to bind to (default: 6969)\n" | ||
357 | "\t-d serverdir\tspecify directory containing white- or black listed torrent info_hashes (default: \".\")\n" | ||
358 | #ifdef WANT_CLOSED_TRACKER | ||
359 | "\t-o\t\tmake tracker an open tracker, e.g. do not check for white list (default: off)\n" | ||
360 | "\t-c\t\tmake tracker a closed tracker, e.g. check each announced torrent against white list (default: on)\n" | ||
361 | #endif | ||
362 | #ifdef WANT_BLACKLIST | ||
363 | "\t-b\t\tmake tracker check its black list, e.g. check each announced torrent against black list (default: on)\n" | ||
364 | "\t-B\t\tmake tracker check its black list, e.g. check each announced torrent against black list (default: off)\n" | ||
365 | #endif | ||
366 | #ifdef WANT_CLOSED_TRACKER | ||
367 | "\n* To white list a torrent, touch a file inside serverdir with info_hash hex string.\n" | ||
368 | #endif | ||
369 | #ifdef WANT_BLACKLIST | ||
370 | #ifndef WANT_CLOSED_TRACKER | ||
371 | "\n" | ||
372 | #endif | ||
373 | "* To white list a torrent, touch a file inside serverdir with info_hash hex string, preprended by '-'.\n" | ||
374 | #endif | ||
375 | ); | ||
349 | } | 376 | } |
350 | 377 | ||
351 | int main( int argc, char **argv ) { | 378 | int main( int argc, char **argv ) { |
@@ -356,17 +383,22 @@ int main( int argc, char **argv ) { | |||
356 | uint16 port = 6969; | 383 | uint16 port = 6969; |
357 | 384 | ||
358 | while( 1 ) { | 385 | while( 1 ) { |
359 | switch( getopt(argc,argv,":i:p:d:") ) { | 386 | switch( getopt(argc,argv,":i:p:d:ocbBh") ) { |
360 | case -1: goto allparsed; | 387 | case -1: goto allparsed; |
361 | case 'i': serverip = optarg; break; | 388 | case 'i': serverip = optarg; break; |
362 | case 'p': port = (uint16)atol( optarg ); break; | 389 | case 'p': port = (uint16)atol( optarg ); break; |
363 | case 'd': serverdir = optarg; break; | 390 | case 'd': serverdir = optarg; break; |
391 | case 'h': help( argv[0]); exit(0); | ||
364 | #ifdef WANT_CLOSED_TRACKER | 392 | #ifdef WANT_CLOSED_TRACKER |
365 | case 'o': g_closedtracker = 0; | 393 | case 'o': g_closedtracker = 0; break; |
366 | case 'c': g_closedtracker = 1; | 394 | case 'c': g_closedtracker = 1; break; |
395 | #endif | ||
396 | #ifdef WANT_BLACKLIST | ||
397 | case 'b': g_check_blacklist = 1; break; | ||
398 | case 'B': g_check_blacklist = 0; break; | ||
367 | #endif | 399 | #endif |
368 | default: | 400 | default: |
369 | case '?': usage( argv[0] ); | 401 | case '?': usage( argv[0] ); exit(1); |
370 | } | 402 | } |
371 | } | 403 | } |
372 | 404 | ||