Changeset 6306 for trunk/cli/cli.c
- Timestamp:
- Jul 9, 2008, 3:31:35 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/cli.c
r6302 r6306 55 55 static sig_atomic_t manualUpdate = 0; 56 56 57 static const char * torrentPath 58 static const char * downloadDir 57 static const char * torrentPath = NULL; 58 static const char * downloadDir = NULL; 59 59 static const char * finishCall = NULL; 60 60 static const char * announce = NULL; … … 166 166 inf->pieceSize, inf->totalSize % inf->pieceSize ); 167 167 168 if( inf->comment [0])168 if( inf->comment && *inf->comment ) 169 169 fprintf( out, "comment:\t%s\n", inf->comment ); 170 if( inf->creator [0])170 if( inf->creator && *inf->creator ) 171 171 fprintf( out, "creator:\t%s\n", inf->creator ); 172 172 if( inf->isPrivate ) … … 175 175 fprintf( out, "file(s):\n" ); 176 176 for( ff=0; ff<inf->fileCount; ++ff ) 177 fprintf( out, "\t%s (%"PRIu64")\n", inf->files[ff].name, inf->files[ff].length ); 177 fprintf( out, "\t%s (%"PRIu64")\n", inf->files[ff].name, 178 inf->files[ff].length ); 178 179 } 179 180 … … 214 215 st->rateUpload, ratioStr ); 215 216 } 216 else if( st->status & TR_STATUS_STOPPED ) 217 { 218 *buf = '\0'; 219 } 217 else *buf = '\0'; 220 218 } 221 219 … … 297 295 { 298 296 int err; 299 tr_metainfo_builder * b uilder= tr_metaInfoBuilderCreate( h, sourceFile );297 tr_metainfo_builder * b = tr_metaInfoBuilderCreate( h, sourceFile ); 300 298 tr_tracker_info ti; 301 299 ti.tier = 0; 302 300 ti.announce = (char*) announce; 303 tr_makeMetaInfo( b uilder, torrentPath, &ti, 1, comment, isPrivate );304 while( !b uilder->isDone ) {301 tr_makeMetaInfo( b, torrentPath, &ti, 1, comment, isPrivate ); 302 while( !b->isDone ) { 305 303 tr_wait( 1000 ); 306 304 printf( "." ); 307 305 } 308 err = b uilder->result;309 tr_metaInfoBuilderFree( b uilder);306 err = b->result; 307 tr_metaInfoBuilderFree( b ); 310 308 return err; 311 309 } … … 339 337 ++leftToScrape; 340 338 tr_webRun( h, url, NULL, scrapeDoneFunc, host ); 339 tr_free( host ); 341 340 tr_free( url ); 342 341 } … … 394 393 if( gotsig ) { 395 394 gotsig = 0; 396 fprintf( stderr,"stopping torrent...\n" );395 printf( "stopping torrent...\n" ); 397 396 tr_torrentStop( tor ); 398 397 } … … 401 400 manualUpdate = 0; 402 401 if ( !tr_torrentCanManualUpdate( tor ) ) 403 fprintf( stderr, "\ rReceived SIGHUP, but can't send a manual update now\n" );402 fprintf( stderr, "\nReceived SIGHUP, but can't send a manual update now\n" ); 404 403 else { 405 fprintf( stderr, "\ rReceived SIGHUP: manual update scheduled\n" );404 fprintf( stderr, "\nReceived SIGHUP: manual update scheduled\n" ); 406 405 tr_torrentManualUpdate( tor ); 407 406 } … … 413 412 414 413 getStatusStr( st, line, sizeof( line ) ); 415 printf( " %-*s\n", LINEWIDTH, line );414 printf( "\r%-*s", LINEWIDTH, line ); 416 415 if( st->error ) 417 printf( " %s\n", st->errorString );416 printf( "\n%s\n", st->errorString ); 418 417 } 419 418
Note: See TracChangeset
for help on using the changeset viewer.