cnping

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

commit afcc565771a37978eb0b54e185fa80482cdebe3a
parent f50885b2661457a0c89e77372b1eb5347baad010
Author: CNLohr <charles@cnlohr.com>
Date:   Thu,  7 Feb 2019 15:54:51 -0500

Merge pull request #53 from dreua/handle_xdisplay_null

Handle xdisplay null
Diffstat:
MCNFGXDriver.c | 10+++++++---
Mcnping.c | 6------
2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/CNFGXDriver.c b/CNFGXDriver.c @@ -91,9 +91,8 @@ void CNFGSetupFullscreen( const char * WindowName, int screen_no ) int screen = XDefaultScreen(CNFGDisplay); int xpos, ypos; - if (!XShapeQueryExtension(CNFGDisplay, &event_basep, &error_basep)) - { - fprintf( stderr, "X-Server does not support shape extension" ); + if (!XShapeQueryExtension(CNFGDisplay, &event_basep, &error_basep)) { + fprintf( stderr, "X-Server does not support shape extension\n" ); exit( 1 ); } @@ -164,6 +163,11 @@ void CNFGTearDown() void CNFGSetup( const char * WindowName, int w, int h ) { CNFGDisplay = XOpenDisplay(NULL); + if ( !CNFGDisplay ) { + fprintf( stderr, "Could not get an X Display.\n%s", + "Are you in text mode or using SSH without X11-Forwarding?\n" ); + exit( 1 ); + } atexit( CNFGTearDown ); XGetWindowAttributes( CNFGDisplay, RootWindow(CNFGDisplay, 0), &CNFGWinAtt ); diff --git a/cnping.c b/cnping.c @@ -36,9 +36,6 @@ uint64_t globalrx; uint64_t globallost; uint8_t pattern[8]; -int runargc; -char ** runargv; - #define PINGCYCLEWIDTH 8192 #define TIMEOUT 4 @@ -636,9 +633,6 @@ int main( int argc, const char ** argv ) } #endif - runargc = argc; - runargv = argv; - pingperiodseconds = 0.02; ExtraPingSize = 0; title[0] = 0;