mirror of
https://frontier.innolan.net/rainlance/amiga-fping.git
synced 2025-11-23 05:58:24 +00:00
Add -D flag to print timestamps before output lines (like Linux ping).
This commit is contained in:
13
src/fping.c
13
src/fping.c
@ -314,6 +314,7 @@ int verbose_flag, quiet_flag, stats_flag, unreachable_flag, alive_flag;
|
|||||||
int elapsed_flag, version_flag, count_flag, loop_flag;
|
int elapsed_flag, version_flag, count_flag, loop_flag;
|
||||||
int per_recv_flag, report_all_rtts_flag, name_flag, addr_flag, backoff_flag;
|
int per_recv_flag, report_all_rtts_flag, name_flag, addr_flag, backoff_flag;
|
||||||
int multif_flag;
|
int multif_flag;
|
||||||
|
int timestamp_flag = 0;
|
||||||
#if defined( DEBUG ) || defined( _DEBUG )
|
#if defined( DEBUG ) || defined( _DEBUG )
|
||||||
int randomly_lose_flag, sent_times_flag, trace_flag, print_per_system_flag;
|
int randomly_lose_flag, sent_times_flag, trace_flag, print_per_system_flag;
|
||||||
int lose_factor;
|
int lose_factor;
|
||||||
@ -492,7 +493,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
/* get command line options */
|
/* get command line options */
|
||||||
|
|
||||||
while( ( c = getopt( argc, argv, "gedhlmnqusaAvz:t:H:i:p:f:r:c:b:C:Q:B:S:I:T:O:" ) ) != EOF )
|
while( ( c = getopt( argc, argv, "gedhlmnqusaAvDz:t:H:i:p:f:r:c:b:C:Q:B:S:I:T:O:" ) ) != EOF )
|
||||||
{
|
{
|
||||||
switch( c )
|
switch( c )
|
||||||
{
|
{
|
||||||
@ -583,6 +584,10 @@ int main( int argc, char **argv )
|
|||||||
stats_flag = 1;
|
stats_flag = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
timestamp_flag = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
loop_flag = 1;
|
loop_flag = 1;
|
||||||
backoff_flag = 0;
|
backoff_flag = 0;
|
||||||
@ -1823,6 +1828,11 @@ int wait_for_reply(long wait_time)
|
|||||||
|
|
||||||
if( per_recv_flag )
|
if( per_recv_flag )
|
||||||
{
|
{
|
||||||
|
if(timestamp_flag) {
|
||||||
|
printf("[%lu.%04lu] ",
|
||||||
|
(unsigned long)current_time.tv_sec,
|
||||||
|
(unsigned long)current_time.tv_usec);
|
||||||
|
}
|
||||||
avg = h->total_time / h->num_recv;
|
avg = h->total_time / h->num_recv;
|
||||||
printf( "%s%s : [%d], %d bytes, %s ms",
|
printf( "%s%s : [%d], %d bytes, %s ms",
|
||||||
h->host, h->pad, this_count, result, sprint_tm( this_reply ) );
|
h->host, h->pad, this_count, result, sprint_tm( this_reply ) );
|
||||||
@ -2810,6 +2820,7 @@ void usage(int is_error)
|
|||||||
fprintf(out, " -B f set exponential backoff factor to f\n" );
|
fprintf(out, " -B f set exponential backoff factor to f\n" );
|
||||||
fprintf(out, " -c n count of pings to send to each target (default %d)\n", count );
|
fprintf(out, " -c n count of pings to send to each target (default %d)\n", count );
|
||||||
fprintf(out, " -C n same as -c, report results in verbose format\n" );
|
fprintf(out, " -C n same as -c, report results in verbose format\n" );
|
||||||
|
fprintf(out, " -D print timestamp before each output line\n" );
|
||||||
fprintf(out, " -e show elapsed time on return packets\n" );
|
fprintf(out, " -e show elapsed time on return packets\n" );
|
||||||
fprintf(out, " -f file read list of targets from a file ( - means stdin) (only if no -g specified)\n" );
|
fprintf(out, " -f file read list of targets from a file ( - means stdin) (only if no -g specified)\n" );
|
||||||
fprintf(out, " -g generate target list (only if no -f specified)\n" );
|
fprintf(out, " -g generate target list (only if no -f specified)\n" );
|
||||||
|
|||||||
Reference in New Issue
Block a user