cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

commit 62d9591e5326dcb3e2b2b6fb90d0ebbc1d25ace3
parent 644b2b703f494a358512742cbc4ac1519d34bd45
Author: cnlohr <lohr85@gmail.com>
Date:   Sat, 23 Mar 2019 23:10:26 -0400

cleanup a few things

Diffstat:
MCNFGWinDriver.c | 7+++----
Mcnping.c | 15+++++++++++++--
Mcnping.exe | 0
Mhttping.c | 11-----------
Mping.c | 10----------
5 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/CNFGWinDriver.c b/CNFGWinDriver.c @@ -8,7 +8,6 @@ #include <malloc.h> //for alloca static HBITMAP lsBitmap; -static HINSTANCE lhInstance; static HWND lsHWND; static HDC lsWindowHDC; static HDC lsHDC; @@ -63,8 +62,8 @@ void CNFGUpdateScreenWithBitmap( unsigned long * data, int w, int h ) { RECT r; - int a = SetBitmapBits(lsBitmap,w*h*4,data); - a = BitBlt(lsWindowHDC, 0, 0, w, h, lsHDC, 0, 0, SRCCOPY); + SetBitmapBits(lsBitmap,w*h*4,data); + BitBlt(lsWindowHDC, 0, 0, w, h, lsHDC, 0, 0, SRCCOPY); UpdateWindow( lsHWND ); int thisw, thish; @@ -212,7 +211,7 @@ void CNFGSetup( const char * name_of_window, int width, int height ) void CNFGHandleInput() { - int ldown = 0; + //int ldown = 0; MSG msg; while( PeekMessage( &msg, lsHWND, 0, 0xFFFF, 1 ) ) diff --git a/cnping.c b/cnping.c @@ -50,6 +50,11 @@ int ExtraPingSize; int in_histogram_mode, in_frame_mode = 1; void HandleGotPacket( int seqno, int timeout ); +#if defined( WINDOWS ) || defined( WIN32 ) +WSADATA wsaData; +#endif + + #define MAX_HISTO_MARKS (TIMEOUT*10000) uint64_t hist_counts[MAX_HISTO_MARKS]; @@ -619,8 +624,6 @@ int main( int argc, const char ** argv ) ShowWindow (GetConsoleWindow(), SW_HIDE); #endif - srand( (int)(OGGetAbsoluteTime()*100000) ); - for( i = 0; i < sizeof( pattern ); i++ ) { pattern[i] = rand(); @@ -716,6 +719,14 @@ int main( int argc, const char ** argv ) #endif return -1; } + +#if defined( WIN32 ) || defined( WINDOWS ) + if( WSAStartup(MAKEWORD(2,2), &wsaData) ) + { + ERRM( "Fault in WSAStartup\n" ); + exit( -2 ); + } +#endif CNFGSetup( title, 320, 155 ); diff --git a/cnping.exe b/cnping.exe Binary files differ. diff --git a/httping.c b/httping.c @@ -227,17 +227,6 @@ static void * PingRunner( void * v ) int StartHTTPing( const char * addy, double minperiod ) { - -#ifdef WIN32 - WSADATA wsaData; - int r = WSAStartup(MAKEWORD(2,2), &wsaData); - if( r ) - { - ERRM( "Fault in WSAStartup\n" ); - exit( -2 ); - } -#endif - struct HTTPPingLaunch *hpl = malloc( sizeof( struct HTTPPingLaunch ) ); hpl->addy = addy; hpl->minperiod = minperiod; diff --git a/ping.c b/ping.c @@ -46,19 +46,9 @@ struct sockaddr_in psaddr; static og_sema_t s_disp; static og_sema_t s_ping; -static og_sema_t s_exec[PINGTHREADS]; void ping_setup() { -#if defined( WIN32 ) || defined( WINDOWS ) - WSADATA wsaData; - int r = WSAStartup(MAKEWORD(2,2), &wsaData); - if( r ) - { - ERRM( "Fault in WSAStartup\n" ); - exit( -2 ); - } -#endif s_disp = OGCreateSema(); s_ping = OGCreateSema(); //This function is executed first.