1
1

A few portability changes, now builds on OSX without warnings.

Этот коммит содержится в:
jef 2012-11-13 11:33:52 -08:00
родитель 0115558217
Коммит 0d48915c69
5 изменённых файлов: 75 добавлений и 75 удалений

Просмотреть файл

@ -59,15 +59,15 @@ static cJSON *JSON_read(int fd);
void
usage()
{
fprintf(stderr, usage_short);
fputs(usage_short, stderr);
}
void
usage_long()
{
fprintf(stderr, usage_long1);
fprintf(stderr, usage_long2);
fputs(usage_long1, stderr);
fputs(usage_long2, stderr);
}
@ -512,7 +512,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
test->settings->tos = strtol(optarg, NULL, 0);
break;
case 'v':
printf(version);
fputs(version, stdout);
system("uname -a");
exit(0);
case 'h':
@ -532,7 +532,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
return (-1);
}
if (test->verbose) {
printf(version);
fputs(version, stdout);
system("uname -a");
}
@ -1336,11 +1336,11 @@ iperf_print_results (struct iperf_test *test)
if (test->protocol->id == Ptcp)
if (has_tcpinfo_retransmits())
printf(report_bw_retrans_header);
fputs(report_bw_retrans_header, stdout);
else
printf(report_bw_header);
fputs(report_bw_header, stdout);
else
printf(report_bw_udp_header);
fputs(report_bw_udp_header, stdout);
start_time = 0.;
sp = SLIST_FIRST(&test->streams);
@ -1367,7 +1367,7 @@ iperf_print_results (struct iperf_test *test)
unit_snprintf(ubuf, UNIT_LEN, (double) (bytes_sent), 'A');
unit_snprintf(nbuf, UNIT_LEN, (double) (bytes_sent / end_time), test->settings->unit_format);
if (test->protocol->id == Ptcp) {
printf(" Sent\n");
fputs(" Sent\n", stdout);
if (has_tcpinfo_retransmits())
printf(report_bw_retrans_format, sp->socket, start_time, end_time, ubuf, nbuf, retransmits);
else
@ -1465,11 +1465,11 @@ print_interval_results(struct iperf_test * test, struct iperf_stream * sp)
*/
if (timeval_equals(&sp->result->start_time, &irp->interval_start_time))
if (has_tcpinfo_retransmits())
printf(report_bw_retrans_header);
fputs(report_bw_retrans_header, stdout);
else
printf(report_bw_header);
fputs(report_bw_header, stdout);
else if (test->num_streams > 1)
printf(report_bw_separator);
fputs(report_bw_separator, stdout);
}
unit_snprintf(ubuf, UNIT_LEN, (double) (irp->bytes_transferred), 'A');

Просмотреть файл

@ -48,7 +48,7 @@ make_cookie(char *cookie)
/* Generate a string based on hostname, time, randomness, and filler. */
(void) gethostname(hostname, sizeof(hostname));
(void) gettimeofday(&tv, 0);
(void) snprintf(temp, sizeof(temp), "%s.%ld.%06ld.%08lx%08lx.%s", hostname, tv.tv_sec, tv.tv_usec, (unsigned long int) random(), (unsigned long int) random(), "1234567890123456789012345678901234567890");
(void) snprintf(temp, sizeof(temp), "%s.%ld.%06ld.%08lx%08lx.%s", hostname, (unsigned long int) tv.tv_sec, (unsigned long int) tv.tv_usec, (unsigned long int) random(), (unsigned long int) random(), "1234567890123456789012345678901234567890");
/* Now truncate it to 36 bytes and terminate. */
memcpy(cookie, temp, 36);

Просмотреть файл

@ -10,71 +10,71 @@
#ifndef IPERF_LOCALE_H
#define IPERF_LOCALE_H
extern char usage_short[];
extern char usage_long1[];
extern char usage_long2[];
extern char version[];
extern const char usage_short[];
extern const char usage_long1[];
extern const char usage_long2[];
extern const char version[];
extern char seperator_line[];
extern const char seperator_line[];
extern char server_port[] ;
extern char client_port[] ;
extern char bind_address[] ;
extern char multicast_ttl[] ;
extern char join_multicast[] ;
extern char client_datagram_size[] ;
extern char server_datagram_size[] ;
extern char tcp_window_size[] ;
extern char udp_buffer_size[] ;
extern char window_default[] ;
extern char wait_server_threads[] ;
extern char test_start_time[];
extern char test_start_bytes[];
extern const char server_port[] ;
extern const char client_port[] ;
extern const char bind_address[] ;
extern const char multicast_ttl[] ;
extern const char join_multicast[] ;
extern const char client_datagram_size[] ;
extern const char server_datagram_size[] ;
extern const char tcp_window_size[] ;
extern const char udp_buffer_size[] ;
extern const char window_default[] ;
extern const char wait_server_threads[] ;
extern const char test_start_time[];
extern const char test_start_bytes[];
extern char report_read_lengths[] ;
extern char report_read_length_times[] ;
extern char report_bw_header[] ;
extern char report_bw_retrans_header[] ;
extern char report_bw_udp_header[] ;
extern char report_bw_format[] ;
extern char report_bw_retrans_format[] ;
extern char report_bw_udp_format[] ;
extern char report_sum_bw_format[] ;
extern char report_sum_bw_retrans_format[] ;
extern char report_sum_bw_udp_format[] ;
extern char report_bw_separator[] ;
extern char report_outoforder[] ;
extern char report_sum_outoforder[] ;
extern char report_peer[] ;
extern char report_mss_unsupported[] ;
extern char report_mss[] ;
extern char report_datagrams[] ;
extern char report_sum_datagrams[] ;
extern char server_reporting[] ;
extern char reportCSV_peer[] ;
extern const char report_read_lengths[] ;
extern const char report_read_length_times[] ;
extern const char report_bw_header[] ;
extern const char report_bw_retrans_header[] ;
extern const char report_bw_udp_header[] ;
extern const char report_bw_format[] ;
extern const char report_bw_retrans_format[] ;
extern const char report_bw_udp_format[] ;
extern const char report_sum_bw_format[] ;
extern const char report_sum_bw_retrans_format[] ;
extern const char report_sum_bw_udp_format[] ;
extern const char report_bw_separator[] ;
extern const char report_outoforder[] ;
extern const char report_sum_outoforder[] ;
extern const char report_peer[] ;
extern const char report_mss_unsupported[] ;
extern const char report_mss[] ;
extern const char report_datagrams[] ;
extern const char report_sum_datagrams[] ;
extern const char server_reporting[] ;
extern const char reportCSV_peer[] ;
extern char report_tcpInfo[] ;
extern char report_tcpInfo[] ;
extern const char report_tcpInfo[] ;
extern const char report_tcpInfo[] ;
extern char warn_window_requested[] ;
extern char warn_window_small[] ;
extern char warn_delay_large[] ;
extern char warn_no_pathmtu[] ;
extern char warn_no_ack[];
extern char warn_ack_failed[];
extern char warn_fileopen_failed[];
extern char unable_to_change_win[];
extern char opt_estimate[];
extern char report_interval_small[] ;
extern char warn_invalid_server_option[] ;
extern char warn_invalid_client_option[] ;
extern char warn_invalid_compatibility_option[] ;
extern char warn_implied_udp[] ;
extern char warn_implied_compatibility[] ;
extern char warn_buffer_too_small[] ;
extern char warn_invalid_single_threaded[] ;
extern char warn_invalid_report_style[] ;
extern char warn_invalid_report[] ;
extern const char warn_window_requested[] ;
extern const char warn_window_small[] ;
extern const char warn_delay_large[] ;
extern const char warn_no_pathmtu[] ;
extern const char warn_no_ack[];
extern const char warn_ack_failed[];
extern const char warn_fileopen_failed[];
extern const char unable_to_change_win[];
extern const char opt_estimate[];
extern const char report_interval_small[] ;
extern const char warn_invalid_server_option[] ;
extern const char warn_invalid_client_option[] ;
extern const char warn_invalid_compatibility_option[] ;
extern const char warn_implied_udp[] ;
extern const char warn_implied_compatibility[] ;
extern const char warn_buffer_too_small[] ;
extern const char warn_invalid_single_threaded[] ;
extern const char warn_invalid_report_style[] ;
extern const char warn_invalid_report[] ;
#endif

Просмотреть файл

@ -89,9 +89,9 @@ get_tcpinfo_retransmits(struct iperf_interval_results *irp)
void
print_tcpinfo(struct iperf_test *test)
{
#if defined(linux)
long int retransmits = 0;
struct iperf_stream *sp;
#if defined(linux)
SLIST_FOREACH(sp, &test->streams, streams) {
retransmits += TAILQ_LAST(&sp->result->interval_results, irlisthead)->tcpInfo.tcpi_retransmits;
}

Просмотреть файл

@ -8,4 +8,4 @@
*/
#define IPERF_VERSION "3.0-BETA5"
#define IPERF_VERSION_DATE "12 Nov 2012"
#define IPERF_VERSION_DATE "13 Nov 2012"