commit e53647a438d8a8078dc125c82d3e4cdb35c138ef
parent bb4ecab77d7eb189ce872671371b4f3b7ee59853
Author: CNLohr <charles@cnlohr.com>
Date: Tue, 5 Dec 2017 17:43:46 -0500
Merge pull request #27 from drbachler/features/window-title
Adding command line argument for window title
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/cnping.c b/cnping.c
@@ -358,12 +358,13 @@ int main( int argc, const char ** argv )
#ifdef WIN32
ERRM( "Need at least a host address to ping.\n" );
#else
- ERRM( "Usage: cnping [host] [period] [extra size] [y-axis scaling]\n"
+ ERRM( "Usage: cnping [host] [period] [extra size] [y-axis scaling] [window title]\n"
" [host] -- domain or IP address of ping target \n"
" [period] -- period in seconds (optional), default 0.02 \n"
" [extra size] -- ping packet extra size (above 12), optional, default = 0 \n"
- " [const y-axis scaling] -- use a fixed scaling factor instead of auto scaling (optional)\n");
+ " [const y-axis scaling] -- use a fixed scaling factor instead of auto scaling (optional)\n"
+ " [window title] -- the title of the window (optional)\n");
#endif
return -1;
}
@@ -379,7 +380,15 @@ int main( int argc, const char ** argv )
pinghost = argv[1];
- sprintf( title, "%s - cnping", pinghost );
+ if (argc > 5)
+ {
+ sprintf(title, "%s", argv[5]);
+ }
+ else
+ {
+ sprintf( title, "%s - cnping", pinghost );
+ }
+
CNFGSetup( title, 320, 155 );
ping_setup();