ping: Sleep 1 second less.
This commit is contained in:
parent
33423f3752
commit
814bbc465b
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
@ -26,15 +27,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(ping);
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
WINE_MESSAGE( "Usage: ping [-n count] [-w timeout] target_name\n\n" );
|
printf("Usage: ping [-n count] [-w timeout] target_name\n\n"
|
||||||
WINE_MESSAGE( "Options:\n" );
|
"Options:\n"
|
||||||
WINE_MESSAGE( " -n Number of echo requests to send.\n" );
|
" -n Number of echo requests to send.\n"
|
||||||
WINE_MESSAGE( " -w Timeout in milliseconds to wait for each reply.\n" );
|
" -w Timeout in milliseconds to wait for each reply.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int n = 0;
|
unsigned int n = 0;
|
||||||
int optc;
|
int optc;
|
||||||
|
|
||||||
WINE_FIXME( "this command currently just sleeps based on -n parameter\n" );
|
WINE_FIXME( "this command currently just sleeps based on -n parameter\n" );
|
||||||
|
@ -44,7 +45,12 @@ int main(int argc, char** argv)
|
||||||
switch(optc)
|
switch(optc)
|
||||||
{
|
{
|
||||||
case 'n':
|
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;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
|
@ -56,6 +62,8 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sleep(n * 1000);
|
if (n != 0)
|
||||||
|
Sleep((n - 1) * 1000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue