From 2edfe1907ad037bff3a5801914a46e3e81396ce9 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 27 Aug 2008 19:22:03 +0000 Subject: [PATCH] (cli) #1226: errors should print to stderr --- cli/cli.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cli/cli.c b/cli/cli.c index 301dfeb5d..2a2c5c9e0 100644 --- a/cli/cli.c +++ b/cli/cli.c @@ -134,7 +134,7 @@ scrapeDoneFunc( struct tr_handle * session UNUSED, tr_bencFree( &top ); } else - printf( "unable to parse response (http code %lu) at %s", response_code, (char*)host ); + fprintf( stderr, "Unable to parse response (http code %lu) at %s", response_code, (char*)host ); --leftToScrape; } @@ -235,15 +235,15 @@ main( int argc, char ** argv ) /* Check the options for validity */ if( !torrentPath ) { - printf( "No torrent specified!\n" ); + fprintf( stderr, "No torrent specified!\n" ); return EXIT_FAILURE; } if( peerPort < 1 || peerPort > 65535 ) { - printf( "Error: Port must between 1 and 65535; got %d\n", peerPort ); + fprintf( stderr, "Error: Port must between 1 and 65535; got %d\n", peerPort ); return EXIT_FAILURE; } if( peerSocketTOS < 0 || peerSocketTOS > 255 ) { - printf( "Error: value must between 0 and 255; got %d\n", peerSocketTOS ); + fprintf( stderr, "Error: value must between 0 and 255; got %d\n", peerSocketTOS ); return EXIT_FAILURE; } @@ -369,7 +369,7 @@ main( int argc, char ** argv ) tr_ctorFree( ctor ); if( !tor ) { - printf( "Failed opening torrent file `%s'\n", torrentPath ); + fprintf( stderr, "Failed opening torrent file `%s'\n", torrentPath ); tr_sessionClose( h ); return EXIT_FAILURE; } @@ -415,7 +415,7 @@ main( int argc, char ** argv ) getStatusStr( st, line, sizeof( line ) ); printf( "\r%-*s", LINEWIDTH, line ); if( st->error ) - printf( "\n%s\n", st->errorString ); + fprintf( stderr, "\n%s\n", st->errorString ); } cleanup: