added -v (version option)

This commit is contained in:
Brian Tierney 2009-11-10 17:05:44 +00:00
parent d44c04d478
commit 08dc8710e1
6 changed files with 24 additions and 15 deletions

View File

@ -5,7 +5,6 @@ Current list of things to fix/add to iperf 3.0
- separate iperf_api.c into iperf_client.c and iperf_utils.c
- verify placment of all timing calls and total_bytes_sent computations
- look for 'XXX' in code and address
- add -v (version)
- much better/standard error handling throughout
- better packaging/makefile, README, LICENCE, etc files
- currently several places in the code where a linked list must be scanned to find the end.

View File

@ -106,7 +106,10 @@ struct iperf_test
int daemon; /* -D option */
int no_delay; /* -N option */
int print_mss; /* -m option */
int domain; /* -V option */
int v6domain; /* -6 option */
int output_format; /* -O option */
int verbose; /* -V (verbose) option */
int debug; /* debug mode */
/* Select related parameters */
int max_fd;

View File

@ -302,7 +302,7 @@ iperf_new_test()
{
struct iperf_test *testp;
printf("in iperf_new_test: reinit default settings \n");
//printf("in iperf_new_test: reinit default settings \n");
testp = (struct iperf_test *) malloc(sizeof(struct iperf_test));
if (!testp)
{

View File

@ -52,8 +52,7 @@
* Strings and other stuff that is locale specific.
* ------------------------------------------------------------------- */
#ifndef IPERF_LOCALE_H
#define IPERF_LOCALE_H
#include "version.h"
/* -------------------------------------------------------------------
@ -79,20 +78,27 @@ Client/Server:\n\
-M, --mss # set TCP maximum segment size (MTU - 40 bytes)\n\
-N, --nodelay set TCP no delay, disabling Nagle's Algorithm\n\
-T, --tcpinfo Output detailed TCP info\n\
-v, --version print version information and quit\n\
Server specific:\n\
-s, --server run in server mode\n\
-U, --single_udp run in single threaded UDP mode\n\
-D, --daemon run the server as a daemon\n"
#ifdef WIN32
" -R, --remove remove service in win32\n"
#endif
;
#ifdef OBSOLETE /* from old iperf: no longer supported. Add someday?? */
#ifdef NOT_YET_SUPPORTED /* still working on these */
-Z, --linux-congestion <algo> set TCP congestion control algorithm (Linux only)\n\
-6, --IPv6Version Set the domain to IPv6\n\
#endif
#ifdef OBSOLETE /* no current plan to support */
-o, --output <filename> output the report or error message to this specified file\n\
-B, --bind <host> bind to <host>, an interface or multicast address\n\
-V, --IPv6Version Set the domain to IPv6\n\
-C, --compatibility for use with older versions does not sent extra msgs
#ifdef WIN32
" -R, --remove remove service in win32\n"
#endif
#endif
const char usage_long2[] = "\
@ -114,8 +120,6 @@ Miscellaneous:\n\
Report bugs to <iperf-users@lists.sourceforge.net>\n";
#ifdef OBSOLETE /* from old iperf: no longer supported. Add some of these back someday */
-v, --version print version information and quit\n\
-Z, --linux-congestion <algo> set TCP congestion control algorithm (Linux only)\n\
-d, --dualtest Do a bidirectional test simultaneously\n\
-L, --listenport # port to recieve bidirectional tests back on\n\
-I, --stdin input the data to be transmitted from stdin\n\
@ -126,7 +130,7 @@ Report bugs to <iperf-users@lists.sourceforge.net>\n";
-y, --reportstyle C report as a Comma-Separated Values
#endif
//const char version[] = "iperf version " IPERF_VERSION " (" IPERF_VERSION_DATE ") " IPERF_THREADS "\n";
const char version[] = "iperf version " IPERF_VERSION " (" IPERF_VERSION_DATE ") \n";
/* -------------------------------------------------------------------
* settings
@ -330,4 +334,3 @@ const char warn_invalid_report[] =
} /* end extern "C" */
#endif
#endif /* IPERF_LOCALE_H */

View File

@ -5,6 +5,7 @@
extern char usage_short[];
extern char usage_long1[];
extern char usage_long2[];
extern char version[];
extern char seperator_line[];

View File

@ -98,7 +98,7 @@ main(int argc, char **argv)
test = iperf_new_test();
iperf_defaults(test); /* sets defaults */
while ((ch = getopt_long(argc, argv, "c:p:st:uP:b:l:w:i:n:mNThM:f:", longopts, NULL)) != -1)
while ((ch = getopt_long(argc, argv, "c:p:st:uP:b:l:w:i:n:mNTvhM:f:", longopts, NULL)) != -1)
{
switch (ch)
{
@ -201,6 +201,9 @@ main(int argc, char **argv)
case 'T':
test->tcp_info = 1;
break;
case 'v': // print version and exit
fprintf( stderr, version );
exit(1);
case 'h':
default:
fprintf(stderr, usage_long1);