#include <stdio.h>
#ifndef _MSC_VER
-//#define DBG
+#ifdef DBG
+#undef DBG
+#endif
/* FIXME: Where should this be? */
#ifdef CopyMemory
LARGE_INTEGER TicksPerUs; /* Ticks per microsecond */
BOOL UsePerformanceCounter;
-
+#ifdef DBG
/* Display the contents of a buffer */
-VOID DisplayBuffer(
+static VOID DisplayBuffer(
PVOID Buffer,
DWORD Size)
{
printf("%02X ", (p[i]) & 0xFF);
}
}
+#endif /* DBG */
/* Display usage information on screen */
-VOID Usage(VOID)
+static VOID Usage(VOID)
{
printf("\nUsage: ping [-t] [-n count] [-l size] [-w timeout] destination-host\n\n");
printf("Options:\n");
}
/* Reset configuration to default values */
-VOID Reset(VOID)
+static VOID Reset(VOID)
{
LARGE_INTEGER PerformanceCounterFrequency;
}
/* Return ULONG in a string */
-ULONG GetULONG(LPSTR String)
+static ULONG GetULONG(LPSTR String)
{
UINT i, Length;
ULONG Value;
i = 0;
- Length = strlen(String);
+ Length = (UINT)_tcslen(String);
while ((i < Length) && ((String[i] < '0') || (String[i] > '9'))) i++;
if ((i >= Length) || ((String[i] < '0') || (String[i] > '9'))) {
InvalidOption = TRUE;
}
/* Return ULONG in a string. Try next paramter if not successful */
-ULONG GetULONG2(LPSTR String1, LPSTR String2, PINT i)
+static ULONG GetULONG2(LPSTR String1, LPSTR String2, PINT i)
{
ULONG Value;
}
/* Parse command line parameters */
-BOOL ParseCmdline(int argc, char* argv[])
+static BOOL ParseCmdline(int argc, char* argv[])
{
INT i;
BOOL ShowUsage;
}
/* Calculate checksum of data */
-WORD Checksum(PUSHORT data, UINT size)
+static WORD Checksum(PUSHORT data, UINT size)
{
ULONG sum = 0;
}
/* Prepare to ping target */
-BOOL Setup(VOID)
+static BOOL Setup(VOID)
{
WORD wVersionRequested;
WSADATA WsaData;
}
/* Close socket */
-VOID Cleanup(VOID)
+static VOID Cleanup(VOID)
{
if (IcmpSock != INVALID_SOCKET)
closesocket(IcmpSock);
WSACleanup();
}
-VOID QueryTime(PLARGE_INTEGER Time)
+static VOID QueryTime(PLARGE_INTEGER Time)
{
if (UsePerformanceCounter) {
if (QueryPerformanceCounter(Time) == 0) {
}
}
-VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
+static VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
{
CHAR Convstr[40];
LARGE_INTEGER LargeTime;
/* Locate the ICMP data and print it. Returns TRUE if the packet was good,
FALSE if not */
-BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
+static BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
{
PIPv4_HEADER IpHeader;
PICMP_ECHO_PACKET Icmp;
}
/* Send and receive one ping */
-BOOL Ping(VOID)
+static BOOL Ping(VOID)
{
INT Status;
SOCKADDR From;