cnping

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

commit 8f62f543d685d60f42a8955bc03d053cde23a96c
parent 8aec6395284b08408359b5cb00f21fda0917156c
Author: cnlohr <lohr85@gmail.com>
Date:   Fri, 27 Sep 2019 01:26:15 -0400

OpenGL + Binary

Switch to OpenGL by default and include cnping.exe

Diffstat:
M.gitignore | 1-
MMakefile | 6+++++-
Mcnping.c | 8++------
Acnping.exe | 0
Mrawdraw/CNFGWinDriver.c | 4+++-
5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,5 +1,4 @@ *.o -*.exe cnping cnping-mousey searchnet diff --git a/Makefile b/Makefile @@ -13,10 +13,14 @@ MINGW32?=i686-w64-mingw32- #If you don't need admin priveleges ADMINFLAGS:= $(ADMINFLAGS) -DWIN_USE_NO_ADMIN_PING -cnping.exe : cnping.c rawdraw/CNFGFunctions.c rawdraw/CNFGWinDriver.c ping.c httping.c +cnping-wingdi.exe : cnping.c rawdraw/CNFGFunctions.c rawdraw/CNFGWinDriver.c ping.c httping.c $(MINGW32)windres resources.rc -o resources.o $(ADMINFLAGS) $(MINGW32)gcc -g -fno-ident -mwindows -m32 $(CFLAGS) resources.o -o $@ $^ -lgdi32 -lws2_32 -s -D_WIN32_WINNT=0x0600 -DWIN32 -liphlpapi -DMINGW_BUILD $(ADMINFLAGS) +cnping.exe : cnping.c rawdraw/CNFGFunctions.c rawdraw/CNFGWinDriver.c ping.c httping.c + $(MINGW32)windres resources.rc -o resources.o $(ADMINFLAGS) + $(MINGW32)gcc -g -fno-ident -mwindows -m32 -DCNFGOGL $(CFLAGS) resources.o -o $@ $^ -lgdi32 -lws2_32 -s -D_WIN32_WINNT=0x0600 -DWIN32 -liphlpapi -lopengl32 -DMINGW_BUILD $(ADMINFLAGS) + cnping : cnping.o rawdraw/CNFGFunctions.o rawdraw/CNFGXDriver.o ping.o httping.o $(CC) $(CFLAGS) -o $@ $^ -lX11 -lm -lpthread $(LDFLAGS) diff --git a/cnping.c b/cnping.c @@ -158,14 +158,14 @@ int load_ping_packet( uint8_t * buffer, int bufflen ) void * PingListen( void * r ) { listener(); - printf( "Fault on listen.\n" ); + ERRM( "Fault on listen.\n" ); exit( -2 ); } void * PingSend( void * r ) { do_pinger( pinghost ); - printf( "Fault on ping.\n" ); + ERRM( "Fault on ping.\n" ); exit( -1 ); } @@ -709,16 +709,12 @@ int main( int argc, const char ** argv ) if( displayhelp ) { - #ifdef WIN32 - ERRM( "cnping "VERSION" Need at least a host address to ping.\n" ); - #else ERRM( "cnping "VERSION" Usage: cnping [host] [period] [extra size] [y-axis scaling] [window title]\n" " (-h) [host] -- domain, IP address of ping target for ICMP or http host, i.e. http://google.com\n" " (-p) [period] -- period in seconds (optional), default 0.02 \n" " (-s) [extra size] -- ping packet extra size (above 12), optional, default = 0 \n" " (-y) [const y-axis scaling] -- use a fixed scaling factor instead of auto scaling (optional)\n" " (-t) [window title] -- the title of the window (optional)\n"); - #endif return -1; } diff --git a/cnping.exe b/cnping.exe Binary files differ. diff --git a/rawdraw/CNFGWinDriver.c b/rawdraw/CNFGWinDriver.c @@ -1,4 +1,4 @@ -//Copyright (c) 2011 <>< Charles Lohr - Under the MIT/x11 or NewBSD License you choose. +//Copyright (c) 2011-2019 <>< Charles Lohr - Under the MIT/x11 or NewBSD License you choose. //Portion from: http://en.wikibooks.org/wiki/Windows_Programming/Window_Creation @@ -96,6 +96,7 @@ LRESULT CALLBACK MyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { +#ifndef CNFGOGL case WM_SYSCOMMAND: //Not sure why, if deactivated, the dc gets unassociated? if( wParam == SC_RESTORE || wParam == SC_MAXIMIZE || wParam == SC_SCREENSAVE ) { @@ -103,6 +104,7 @@ LRESULT CALLBACK MyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SelectObject( lsWindowHDC, lsBitmap ); } break; +#endif case WM_DESTROY: HandleDestroy(); CNFGTearDown();