#include "tmalloc.h"
#include "top.h"
+void
+usage() {
+ fputs(
+ "Copyright (c) 2004-2007 Teodor Sigaev <teodor@sigaev.ru>. 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;
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;