Commit 814bbc46 authored by Borut Razem's avatar Borut Razem Committed by Alexandre Julliard

ping: Sleep 1 second less.

parent 33423f37
......@@ -18,6 +18,7 @@
*/
#include <unistd.h>
#include <stdio.h>
#include <windows.h>
#include "wine/debug.h"
......@@ -26,15 +27,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(ping);
static void usage(void)
{
WINE_MESSAGE( "Usage: ping [-n count] [-w timeout] target_name\n\n" );
WINE_MESSAGE( "Options:\n" );
WINE_MESSAGE( " -n Number of echo requests to send.\n" );
WINE_MESSAGE( " -w Timeout in milliseconds to wait for each reply.\n" );
printf("Usage: ping [-n count] [-w timeout] target_name\n\n"
"Options:\n"
" -n Number of echo requests to send.\n"
" -w Timeout in milliseconds to wait for each reply.\n");
}
int main(int argc, char** argv)
{
int n = 0;
unsigned int n = 0;
int optc;
WINE_FIXME( "this command currently just sleeps based on -n parameter\n" );
......@@ -44,7 +45,12 @@ int main(int argc, char** argv)
switch(optc)
{
case 'n':
n = atoi( optarg );
n = atoi(optarg);
if (n == 0)
{
printf("Bad value for option -n, valid range is from 1 to 4294967295.\n");
exit(1);
}
break;
case '?':
usage();
......@@ -56,6 +62,8 @@ int main(int argc, char** argv)
}
}
Sleep(n * 1000);
if (n != 0)
Sleep((n - 1) * 1000);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment