X-Git-Url: http://sigaev.ru/git/gitweb.cgi?p=remotetop.git;a=blobdiff_plain;f=rtop.c;fp=rtop.c;h=410e5c6761e043fb6c8baaa338e80c7b36968b90;hp=c204aaf9cf1fa437a539ad889855c5eb6e94494b;hb=e3fdb3b9f9b62a71c2a11b5e27ee47214901a3e2;hpb=0db0da94f6e0d2809d5176cb408f40773d6073ca diff --git a/rtop.c b/rtop.c index c204aaf..410e5c6 100644 --- a/rtop.c +++ b/rtop.c @@ -44,11 +44,25 @@ #include "tmalloc.h" #include "top.h" +void +usage() { + fputs( + "Copyright (c) 2004-2007 Teodor Sigaev . All rights reserved.\n" + "rtop - read collected load of remote servers\n" + "./rtop [-D] -h HOST [-p PORT]\n" + " -D - debug mode\n" + " -h HOST - server\n" + " -p PRT - server's port\n", + stdout + ); + exit(1); +} + int main( int argc, char *argv[] ) { int ch; int debug=0; - char *host="127.0.0.1"; + char *host=NULL; int port=TOPD_SERVER_DEFAULT_PORT; int i; @@ -71,14 +85,15 @@ main( int argc, char *argv[] ) { port=atoi(optarg); break; default: + usage(); return 1; } } - if ( debug ) - opentlog( TL_OPEN_STDERR, TL_DEBUG, NULL); - else - opentlog( TL_OPEN_SYSLOG, TL_INFO, NULL); + if (!host) + usage(); + + opentlog( TL_OPEN_STDERR, (debug) ? TL_DEBUG : TL_INFO, NULL); TC_fillConnection(&cs, host, port); cs.buf = (char*)pmsg;